From 578b37904c7376bfc711ddb89f23a203e4a70fdd Mon Sep 17 00:00:00 2001 From: Marco Bardelli Date: Fri, 4 Nov 2022 22:48:51 +0100 Subject: [PATCH 01/12] added minimal support for es6 import_style --- generator/js_generator.cc | 50 +++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 10 deletions(-) diff --git a/generator/js_generator.cc b/generator/js_generator.cc index 6ca0ad32..2bdec1e8 100644 --- a/generator/js_generator.cc +++ b/generator/js_generator.cc @@ -226,7 +226,8 @@ std::string MaybeCrossFileRef(const GeneratorOptions& options, const FileDescriptor* from_file, const Descriptor* to_message) { if ((options.import_style == GeneratorOptions::kImportCommonJs || - options.import_style == GeneratorOptions::kImportCommonJsStrict) && + options.import_style == GeneratorOptions::kImportCommonJsStrict || + options.import_style == GeneratorOptions::kImportEs6) && from_file != to_message->file()) { // Cross-file ref in CommonJS needs to use the module alias instead of // the global name. @@ -3618,8 +3619,14 @@ void Generator::GenerateFile(const GeneratorOptions& options, // Generate "require" statements. if ((options.import_style == GeneratorOptions::kImportCommonJs || - options.import_style == GeneratorOptions::kImportCommonJsStrict)) { - printer->Print("var jspb = require('google-protobuf');\n"); + options.import_style == GeneratorOptions::kImportCommonJsStrict || + options.import_style == GeneratorOptions::kImportEs6)) { + + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("import * as jspb from 'google-protobuf';\n"); + } else { + printer->Print("var jspb = require('google-protobuf');\n"); + } printer->Print("var goog = jspb;\n"); // Do not use global scope in strict mode @@ -3648,13 +3655,22 @@ void Generator::GenerateFile(const GeneratorOptions& options, " Function('return this')();\n\n"); } - for (int i = 0; i < file->dependency_count(); i++) { - const std::string& name = file->dependency(i)->name(); - printer->Print( - "var $alias$ = require('$file$');\n" - "goog.object.extend(proto, $alias$);\n", - "alias", ModuleAlias(name), "file", - GetRootPath(file->name(), name) + GetJSFilename(options, name)); + if (options.import_style == GeneratorOptions::kImportEs6) { + for (int i = 0; i < file->dependency_count(); i++) { + const std::string& name = file->dependency(i)->name(); + printer->Print("import * as $alias$ from '$file$';\n" + "goog.object.extend(proto, $alias$);\n", + "alias", ModuleAlias(name), "file", + GetRootPath(file->name(), name) + GetJSFilename(options, name)); + } + } else { + for (int i = 0; i < file->dependency_count(); i++) { + const std::string& name = file->dependency(i)->name(); + printer->Print("var $alias$ = require('$file$');\n" + "goog.object.extend(proto, $alias$);\n", + "alias", ModuleAlias(name), "file", + GetRootPath(file->name(), name) + GetJSFilename(options, name)); + } } } @@ -3698,6 +3714,20 @@ void Generator::GenerateFile(const GeneratorOptions& options, } else if (options.import_style == GeneratorOptions::kImportCommonJsStrict) { printer->Print("goog.object.extend(exports, proto);\n", "package", GetNamespace(options, file)); + } else if (options.import_style == GeneratorOptions::kImportEs6) { + std::string package = GetNamespace(options, file); + for (std::set::iterator it = provided.begin(); + it != provided.end(); ++it) { + std::string fullname = *it; + std::string name = fullname.substr(package.length()); + + std::string::iterator iend = std::remove(name.begin(), name.end(), '.'); + name.resize(name.length()-(name.end()-iend)); + name.shrink_to_fit(); + + printer->Print("export const $name$ = $fullname$;\n", + "name", name, "fullname", fullname); + } } // Emit well-known type methods. From fdf42cd3d5edba368ca9b51f726348dc3b0bdb05 Mon Sep 17 00:00:00 2001 From: Jacob Fugal Date: Tue, 26 Nov 2024 13:40:16 -0700 Subject: [PATCH 02/12] generate es6 library with .d.ts --- generator/js_generator.cc | 379 ++++++++++++++++++++++++++-- generator/js_generator.h | 35 ++- generator/well_known_types_embed.cc | 40 ++- generator/well_known_types_embed.h | 1 + 4 files changed, 434 insertions(+), 21 deletions(-) diff --git a/generator/js_generator.cc b/generator/js_generator.cc index 2bdec1e8..227529d1 100644 --- a/generator/js_generator.cc +++ b/generator/js_generator.cc @@ -3505,6 +3505,12 @@ bool GeneratorOptions::ParseFromOptions( return false; } annotate_code = true; + } else if (option.first == "generate_dts") { + if (!option.second.empty()) { + *error = "Unexpected option value for generate_dts"; + return false; + } + generate_dts = true; } else { // Assume any other option is an output directory, as long as it is a bare // `key` rather than a `key=value` option. @@ -3517,22 +3523,38 @@ bool GeneratorOptions::ParseFromOptions( } if (import_style != kImportClosure && - (add_require_for_enums || testonly || !library.empty() || - extension != ".js" || one_output_file_per_input_file)) { + (add_require_for_enums || testonly || extension != ".js" || + one_output_file_per_input_file)) { *error = - "The add_require_for_enums, testonly, library, extension, and " + "The add_require_for_enums, testonly, extension, and " "one_output_file_per_input_file options should only be " "used for import_style=closure"; return false; } + if (import_style != kImportClosure && import_style != kImportEs6 && + !library.empty()) { + *error = + "The library option should only be " + "used for import_style=closure or es6"; + return false; + } + + if (generate_dts && (import_style != kImportEs6 || library.empty())) { + *error = + "The generate_dts option should only be " + "used for import_style=es6 and with library set"; + return false; + } + return true; } GeneratorOptions::OutputMode GeneratorOptions::output_mode() const { - // We use one output file per input file if we are not using Closure or if - // this is explicitly requested. - if (import_style != kImportClosure || one_output_file_per_input_file) { + // We use one output file per input file if we are not using Closure or ES6, + // or if this is explicitly requested. + if ((import_style != kImportClosure && import_style != kImportEs6) || + one_output_file_per_input_file) { return kOneOutputFilePerInputFile; } @@ -3541,6 +3563,10 @@ GeneratorOptions::OutputMode GeneratorOptions::output_mode() const { return kEverythingInOneFile; } + // SCC for ES6 is not implemented + ABSL_CHECK(import_style != kImportEs6) + << "ES6 must specify either one_output_file_per_input_file or library"; + // Otherwise, we create one output file per SCC. return kOneOutputFilePerSCC; } @@ -3585,12 +3611,7 @@ void Generator::GenerateFileAndDeps( bool Generator::GenerateFile(const FileDescriptor* file, const GeneratorOptions& options, GeneratorContext* context, - bool use_short_name) const { - std::string filename = - options.output_dir + "/" + - GetJSFilename(options, use_short_name - ? file->name().substr(file->name().rfind('/')) - : file->name()); + const std::string& filename) const { std::unique_ptr output(context->Open(filename)); ABSL_CHECK(output); GeneratedCodeInfo annotations; @@ -3629,8 +3650,9 @@ void Generator::GenerateFile(const GeneratorOptions& options, } printer->Print("var goog = jspb;\n"); - // Do not use global scope in strict mode - if (options.import_style == GeneratorOptions::kImportCommonJsStrict) { + // Do not use global scope in strict mode or with ES6 + if (options.import_style == GeneratorOptions::kImportCommonJsStrict || + options.import_style == GeneratorOptions::kImportEs6) { printer->Print("var proto = {};\n\n"); } else { // To get the global object we call a function with .call(null), this will @@ -3739,6 +3761,315 @@ void Generator::GenerateFile(const GeneratorOptions& options, } } +bool Generator::GenerateDTS(const FileDescriptor* file, + const GeneratorOptions& options, + GeneratorContext* context, + const std::string& js_filename) const { + if (!options.generate_dts) { + return true; + } + + ABSL_CHECK(options.import_style == GeneratorOptions::kImportEs6); + + std::string dts_filename = + js_filename.substr(0, js_filename.length() - options.extension.length()) + + ".d.ts"; + std::unique_ptr output(context->Open(dts_filename)); + ABSL_CHECK(output); + io::Printer printer(output.get(), '$', nullptr); + + GenerateDTS(options, &printer, file); + + return !printer.failed(); +} + +const std::string DTS_INDENT = " "; + +void Generator::GenerateDTS(const GeneratorOptions& options, + io::Printer* printer, + const FileDescriptor* file) const { + std::string ns = GetNamespace(options, file); + printer->Print("declare namespace $ns$ {\n", "ns", ns); + + const std::string& indent = DTS_INDENT; + std::set exported; + for (int i = 0; i < file->message_type_count(); i++) { + auto desc = file->message_type(i); + GenerateMessageDTS(options, printer, desc, indent); + exported.insert(desc->name()); + } + for (int i = 0; i < file->enum_type_count(); i++) { + auto enumdesc = file->enum_type(i); + GenerateEnumDTS(options, printer, enumdesc, indent); + exported.insert(enumdesc->name()); + } + + printer->Print("}\n"); + + if (!exported.empty()) { + for (auto name : exported) { + std::string fullname = ns + "." + name; + printer->Print( + "\ndeclare module \"goog:$fullname$ \" {\n" + "$indent$import $name$ = $fullname$;\n" + "$indent$export default $name$;\n" + "}\n", + "name", name, "fullname", fullname, "indent", indent); + } + + printer->Print("\n"); + for (auto name : exported) { + std::string fullname = ns + "." + name; + printer->Print("import $name$ = $fullname$;\n", "name", name, "fullname", + fullname); + } + printer->Print("\n"); + printer->Print("export {\n"); + for (auto name : exported) { + printer->Print("$indent$$name$,\n", "name", name, "indent", indent); + } + printer->Print("};\n"); + } + + // Emit well-known type methods. + for (FileToc* toc = well_known_types_js; toc->name != NULL; toc++) { + std::string name = std::string("google/protobuf/") + toc->name; + if (name == StripProto(file->name()) + ".js") { + printer->Print(toc->dts_data); + } + } +} + +void Generator::GenerateMessageDTS(const GeneratorOptions& options, + io::Printer* printer, const Descriptor* desc, + const std::string& indent) const { + if (IgnoreMessage(desc)) { + return; + } + + printer->Print("$indent$export class $classname$ extends jspb.Message {\n", + "classname", desc->name(), "indent", indent); + + const std::string nested_indent = indent + DTS_INDENT; + printer->Print("$indent$constructor(data?: any[] | null);\n", "indent", + nested_indent); + + if (HasOneofFields(desc)) { + for (int i = 0; i < desc->oneof_decl_count(); i++) { + GenerateOneofDTS(options, printer, desc->oneof_decl(i), nested_indent); + } + } + + printer->Print( + "$indent$toObject(includeInstance?: boolean): GlobalObject;\n" + "$indent$static toObject(includeInstance: boolean | undefined, msg: " + "$class$): GlobalObject;\n" + "$indent$static deserializeBinary(bytes: jspb.ByteSource): $class$;\n" + "$indent$static deserializeBinaryFromReader(msg: $class$, reader: " + "jspb.BinaryReader): $class$;\n" + "$indent$serializeBinary(): Uint8Array;\n" + "$indent$static serializeBinaryToWriter(message: $class$, writer: " + "jspb.BinaryWriter): void;\n", + "class", GetMessagePath(options, desc), "indent", nested_indent); + + for (int i = 0; i < desc->nested_type_count(); i++) { + GenerateMessageDTS(options, printer, desc->nested_type(i), nested_indent); + } + for (int i = 0; i < desc->enum_type_count(); i++) { + GenerateEnumDTS(options, printer, desc->enum_type(i), nested_indent); + } + + for (int i = 0; i < desc->field_count(); i++) { + if (!IgnoreField(desc->field(i))) { + GenerateFieldDTS(options, printer, desc->field(i), nested_indent); + } + } + + printer->Print("$indent$}\n\n", "indent", indent); +} + +void Generator::GenerateOneofDTS(const GeneratorOptions& options, + io::Printer* printer, + const OneofDescriptor* oneof, + const std::string& indent) const { + if (IgnoreOneof(oneof)) { + return; + } + printer->Print("$indent$enum $oneof$Case = {\n", "oneof", JSOneofName(oneof), + "indent", indent); + + const std::string nested_indent = indent + DTS_INDENT; + printer->Print("$indent$$upcase$_NOT_SET: 0,\n", "upcase", + ToEnumCase(oneof->name()), "indent", nested_indent); + + for (int i = 0; i < oneof->field_count(); i++) { + auto field = oneof->field(i); + if (IgnoreField(field)) { + continue; + } + printer->Print("$indent$$upcase$: $number$,\n", "upcase", + ToEnumCase(field->name()), "number", JSFieldIndex(field), + "indent", nested_indent); + } + + printer->Print("$indent$};\n", "indent", indent); + printer->Print("$indent$get$oneof$Case(): $class$.$oneof$Case;\n", "class", + GetMessagePath(options, oneof->containing_type()), "oneof", + JSOneofName(oneof), "indent", indent); +} + +std::string DTSFieldType(const GeneratorOptions& options, + const FieldDescriptor* field, + BytesMode bytes_mode = BYTES_DEFAULT, + bool force_singular = false) { + std::string jstype = JSTypeName(options, field, bytes_mode); + if (!force_singular && field->is_repeated()) { + if (field->type() == FieldDescriptor::TYPE_BYTES && + bytes_mode == BYTES_DEFAULT) { + jstype = "Uint8Array[] | string[]"; + } else { + jstype += "[]"; + } + } + return jstype; +} + +std::string DTSFieldReturnType(const GeneratorOptions& options, + const FieldDescriptor* field, + BytesMode bytes_mode = BYTES_DEFAULT) { + std::string jstype = DTSFieldType(options, field, bytes_mode); + if (DeclaredReturnTypeIsNullable(options, field)) { + jstype += " | null"; + } + return jstype; +} + +std::string DTSFieldSetterType(const GeneratorOptions& options, + const FieldDescriptor* field) { + std::string jstype = DTSFieldType(options, field); + if (SetterAcceptsNull(options, field)) { + jstype += " | null"; + } + if (SetterAcceptsUndefined(options, field)) { + jstype += " | undefined"; + } + return jstype; +} + +void Generator::GenerateFieldDTS(const GeneratorOptions& options, + io::Printer* printer, + const FieldDescriptor* field, + const std::string& indent) const { + if (field->is_map()) { + printer->Print( + "$indent$$gettername$(noLazyCreate?: boolean): " + "jspb.Map<$keytype$,$valuetype$> " + "| undefined;\n", + "class", GetMessagePath(options, field->containing_type()), + "gettername", "get" + JSGetterName(options, field), "keytype", + DTSFieldType(options, MapFieldKey(field)), "valuetype", + DTSFieldType(options, MapFieldValue(field)), "indent", indent); + } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { + printer->Print("$indent$$gettername$(): $type$;\n", "gettername", + "get" + JSGetterName(options, field), "type", + DTSFieldReturnType(options, field), "indent", indent); + printer->Print("$indent$$settername$(value: $optionaltype$): $class$;\n", + "settername", "set" + JSGetterName(options, field), + "optionaltype", DTSFieldSetterType(options, field), "class", + GetMessagePath(options, field->containing_type()), "indent", + indent); + if (field->is_repeated()) { + printer->Print( + "$indent$$addername$(value?: $optionaltype$, index?: number): " + "$optionaltype$;\n", + "addername", + "add" + + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list */ true), + "optionaltype", JSTypeName(options, field, BYTES_DEFAULT), "indent", + indent); + } + } else { + BytesMode bytes_mode = + field->type() == FieldDescriptor::TYPE_BYTES && !options.binary + ? BYTES_B64 + : BYTES_DEFAULT; + printer->Print("$indent$$gettername$(): $type$;\n", "gettername", + "get" + JSGetterName(options, field), "type", + DTSFieldReturnType(options, field, bytes_mode), "indent", + indent); + + if (field->type() == FieldDescriptor::TYPE_BYTES) { + printer->Print("$indent$get$name$(): $type$;\n", "type", + DTSFieldReturnType(options, field, BYTES_B64), "name", + JSGetterName(options, field, BYTES_B64), "indent", indent); + printer->Print("$indent$get$name$(): $type$;\n", "type", + DTSFieldReturnType(options, field, BYTES_U8), "name", + JSGetterName(options, field, BYTES_U8), "indent", indent); + } + + printer->Print("$indent$$settername$(value: $optionaltype$): $class$;\n", + "settername", "set" + JSGetterName(options, field), + "optionaltype", DTSFieldSetterType(options, field), "class", + GetMessagePath(options, field->containing_type()), "indent", + indent); + + if (field->is_repeated()) { + printer->Print( + "$indent$$addername$(value: $optionaltype$, index?: number): " + "$class$;\n", + "addername", + "add" + JSGetterName(options, field, BYTES_DEFAULT, + /* drop_list = */ true), + "optionaltype", DTSFieldType(options, field, BYTES_DEFAULT, true), + "class", GetMessagePath(options, field->containing_type()), "indent", + indent); + } + } + + if (field->is_map() || field->is_repeated() || + (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && + !field->is_required()) || + HasFieldPresence(options, field)) { + printer->Print("$indent$$clearername$(): $class$;\n", "clearername", + "clear" + JSGetterName(options, field), "class", + GetMessagePath(options, field->containing_type()), "indent", + indent); + } + + if (HasFieldPresence(options, field)) { + printer->Print("$indent$$hasername$(): boolean;\n", "hasername", + "has" + JSGetterName(options, field), "indent", indent); + } +} + +void Generator::GenerateEnumDTS(const GeneratorOptions& options, + io::Printer* printer, + const EnumDescriptor* enumdesc, + const std::string& indent) const { + printer->Print("$indent$enum $name$ {\n", "indent", indent, "name", + enumdesc->name()); + + std::set used_name; + std::vector valid_values; + for (int i = 0; i < enumdesc->value_count(); i++) { + const EnumValueDescriptor* value = enumdesc->value(i); + if (enumdesc->options().allow_alias() && + !used_name.insert(ToEnumCase(value->name())).second) { + continue; + } + valid_values.push_back(value); + } + + const std::string nested_indent = indent + DTS_INDENT; + for (auto value : valid_values) { + printer->Print("$indent$$name$ = $value$,\n", "indent", nested_indent, + "name", ToEnumCase(value->name()), "value", + absl::StrCat(value->number())); + } + + printer->Print("$indent$}\n\n", "indent", indent); +} + bool Generator::GenerateAll(const std::vector& files, const std::string& parameter, GeneratorContext* context, @@ -3754,6 +4085,16 @@ bool Generator::GenerateAll(const std::vector& files, // All output should go in a single file. std::string filename = options.output_dir + "/" + options.library + options.GetFileNameExtension(); + if (options.import_style == GeneratorOptions::kImportEs6) { + // all-in-one for ES6 not actually supported. but we abuse this branch to + // allow specifying the output name via library when there's a single + // input. + ABSL_CHECK(files.size() == 1) + << "ES6 only supports one input file with library option"; + return GenerateFile(files[0], options, context, filename) && + GenerateDTS(files[0], options, context, filename); + } + std::unique_ptr output(context->Open(filename)); ABSL_CHECK(output.get()); GeneratedCodeInfo annotations; @@ -3812,7 +4153,11 @@ bool Generator::GenerateAll(const std::vector& files, for (auto file : files) { // Force well known type to generate in a whole file. if (IsWellKnownTypeFile(file)) { - if (!GenerateFile(file, options, context, true)) { + std::string filename = + options.output_dir + "/" + + GetJSFilename(options, + file->name().substr(file->name().rfind('/'))); + if (!GenerateFile(file, options, context, filename)) { return false; } generated = true; @@ -3959,7 +4304,9 @@ bool Generator::GenerateAll(const std::vector& files, // Generate one output file per input (.proto) file. for (auto file : files) { - if (!GenerateFile(file, options, context, false)) { + std::string filename = + options.output_dir + "/" + GetJSFilename(options, file->name()); + if (!GenerateFile(file, options, context, filename)) { return false; } } diff --git a/generator/js_generator.h b/generator/js_generator.h index 98b8126e..588d7e0e 100644 --- a/generator/js_generator.h +++ b/generator/js_generator.h @@ -81,7 +81,8 @@ struct GeneratorOptions { library(""), extension(".js"), one_output_file_per_input_file(false), - annotate_code(false) {} + annotate_code(false), + generate_dts(false) {} bool ParseFromOptions( const std::vector >& options, @@ -89,7 +90,10 @@ struct GeneratorOptions { // Returns the file name extension to use for generated code. std::string GetFileNameExtension() const { - return import_style == kImportClosure ? extension : "_pb.js"; + return (import_style == kImportClosure || + (import_style == kImportEs6 && !library.empty())) + ? extension + : "_pb.js"; } enum OutputMode { @@ -124,6 +128,9 @@ struct GeneratorOptions { // are encoded as base64 proto of GeneratedCodeInfo message (see // descriptor.proto). bool annotate_code; + // If true, generate a .d.ts output in addition to library output. Only valid + // with import_style=es6 and library. + bool generate_dts; }; // CodeGenerator implementation which generates a JavaScript source file and @@ -220,10 +227,32 @@ class Generator : public CodeGenerator { // If use_short_name is true, the generated file's name will only be short // name that without directory, otherwise filename equals file->name() bool GenerateFile(const FileDescriptor* file, const GeneratorOptions& options, - GeneratorContext* context, bool use_short_name) const; + GeneratorContext* context, + const std::string& filename) const; void GenerateFile(const GeneratorOptions& options, io::Printer* printer, const FileDescriptor* file) const; + // Generate declarations for all things in a proto file into one .d.ts file. + // If use_short_name is true, the generated file's name will only be short + // name that without directory, otherwise filename equals file->name() + bool GenerateDTS(const FileDescriptor* file, const GeneratorOptions& options, + GeneratorContext* context, + const std::string& filename) const; + void GenerateDTS(const GeneratorOptions& options, io::Printer* printer, + const FileDescriptor* file) const; + void GenerateMessageDTS(const GeneratorOptions& options, io::Printer* printer, + const Descriptor* desc, + const std::string& indent) const; + void GenerateOneofDTS(const GeneratorOptions& options, io::Printer* printer, + const OneofDescriptor* oneof, + const std::string& indent) const; + void GenerateFieldDTS(const GeneratorOptions& options, io::Printer* printer, + const FieldDescriptor* field, + const std::string& indent) const; + void GenerateEnumDTS(const GeneratorOptions& options, io::Printer* printer, + const EnumDescriptor* enumdesc, + const std::string& indent) const; + // Generate definitions for all message classes and enums in all files, // processing the files in dependence order. void GenerateFilesInDepOrder( diff --git a/generator/well_known_types_embed.cc b/generator/well_known_types_embed.cc index 08c38200..5d433dd7 100644 --- a/generator/well_known_types_embed.cc +++ b/generator/well_known_types_embed.cc @@ -86,8 +86,15 @@ struct FileToc well_known_types_js[] = { " } else {\n" " return null;\n" " }\n" - "};\n" - }, + "};\n", + "declare namespace proto.google.protobuf {\n" + " export class Any {\n" + " getTypeName(): string;\n" + " pack(serialized: Uint8Array, name: string, typeUrlPrefix?: string): " + "void;\n" + " unpack(deserialize: (Uint8Array) => T, name: string): T | null;\n" + " }\n" + "};\n"}, {"timestamp.js", "/* This code will be inserted into generated code for\n" " * google/protobuf/timestamp.proto. */\n" @@ -124,6 +131,13 @@ struct FileToc well_known_types_js[] = { " var timestamp = new proto.google.protobuf.Timestamp();\n" " timestamp.fromDate(value);\n" " return timestamp;\n" + "};\n", + "declare namespace proto.google.protobuf {\n" + " export class Timestamp {\n" + " toDate(): Date;\n" + " fromDate(value: Date): void;\n" + " static fromDate(value: Date): proto.google.protobuf.Timestamp;\n" + " }\n" "};\n"}, {"struct.js", "/* This code will be inserted into generated code for\n" @@ -265,6 +279,28 @@ struct FileToc well_known_types_js[] = { " }\n" "\n" " return ret;\n" + "};\n", + "declare namespace proto.google.protobuf {\n" + " export type JavaScriptValue = " + "null|number|string|boolean|JavaScriptValue[]|{ [field: string]: " + "JavaScriptValue }};\n" + " export class Value {\n" + " toJavaScript(): proto.google.protobuf.JavaScriptValue;\n" + " static fromJavaScript(value: proto.google.protobuf.JavaScriptValue): " + "proto.google.protobuf.Value;\n" + " }\n" + " export class ListValue {\n" + " toJavaScript(): proto.google.protobuf.JavaScriptValue[];\n" + " static fromJavaScript(value: " + "proto.google.protobuf.JavaScriptValue[]): " + "proto.google.protobuf.ListValue;\n" + " }\n" + " export class Struct {\n" + " toJavaScript(): { [field: string]: " + "proto.google.protobuf.JavaScriptValue };\n" + " static fromJavaScript(value: { [field: string]: " + "proto.google.protobuf.JavaScriptValue }): proto.google.protobuf.Struct;\n" + " }\n" "};\n"}, {NULL, NULL} // Terminate the list. }; diff --git a/generator/well_known_types_embed.h b/generator/well_known_types_embed.h index 84bad437..08e494f3 100644 --- a/generator/well_known_types_embed.h +++ b/generator/well_known_types_embed.h @@ -36,6 +36,7 @@ struct FileToc { const char* name; const char* data; + const char* dts_data; }; extern struct FileToc well_known_types_js[]; From 980a4b2f1caca87e66da2fab3d651294522d3e78 Mon Sep 17 00:00:00 2001 From: Jacob Fugal Date: Mon, 6 Jan 2025 11:19:17 -0700 Subject: [PATCH 03/12] add test.proto output example --- example/README.md | 11 + example/test.d.ts | 1013 +++++ example/test.js | 9993 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 11017 insertions(+) create mode 100644 example/README.md create mode 100644 example/test.d.ts create mode 100644 example/test.js diff --git a/example/README.md b/example/README.md new file mode 100644 index 00000000..dcd9d5fd --- /dev/null +++ b/example/README.md @@ -0,0 +1,11 @@ +# Generation + +Built generator plugin: + +`bazel build generator:protoc-gen-js` + +then: + +`protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=protos --js_out=library=example/test,import_style=es6,generate_dts,binary:. protos/test.proto` + +Generated both `example/test.js` with ES6-style imports/exports and `example/test.d.ts` with TypeScript definitions. diff --git a/example/test.d.ts b/example/test.d.ts new file mode 100644 index 00000000..b5944de3 --- /dev/null +++ b/example/test.d.ts @@ -0,0 +1,1013 @@ +declare namespace proto.jspb.test { + export class Empty extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Empty): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Empty; + static deserializeBinaryFromReader(msg: proto.jspb.test.Empty, reader: jspb.BinaryReader): proto.jspb.test.Empty; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.Empty, writer: jspb.BinaryWriter): void; + } + + export class EnumContainer extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.EnumContainer): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.EnumContainer; + static deserializeBinaryFromReader(msg: proto.jspb.test.EnumContainer, reader: jspb.BinaryReader): proto.jspb.test.EnumContainer; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.EnumContainer, writer: jspb.BinaryWriter): void; + getOuterEnum(): proto.jspb.test.OuterEnum; + setOuterEnum(value: proto.jspb.test.OuterEnum): proto.jspb.test.EnumContainer; + clearOuterEnum(): proto.jspb.test.EnumContainer; + hasOuterEnum(): boolean; + } + + export class Simple1 extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Simple1): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Simple1; + static deserializeBinaryFromReader(msg: proto.jspb.test.Simple1, reader: jspb.BinaryReader): proto.jspb.test.Simple1; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.Simple1, writer: jspb.BinaryWriter): void; + getAString(): string; + setAString(value: string): proto.jspb.test.Simple1; + clearAString(): proto.jspb.test.Simple1; + hasAString(): boolean; + getARepeatedStringList(): string[]; + setARepeatedStringList(value: string[]): proto.jspb.test.Simple1; + addARepeatedString(value: string, index?: number): proto.jspb.test.Simple1; + clearARepeatedStringList(): proto.jspb.test.Simple1; + getABoolean(): boolean; + setABoolean(value: boolean): proto.jspb.test.Simple1; + clearABoolean(): proto.jspb.test.Simple1; + hasABoolean(): boolean; + } + + export class Simple2 extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Simple2): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Simple2; + static deserializeBinaryFromReader(msg: proto.jspb.test.Simple2, reader: jspb.BinaryReader): proto.jspb.test.Simple2; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.Simple2, writer: jspb.BinaryWriter): void; + getAString(): string; + setAString(value: string): proto.jspb.test.Simple2; + clearAString(): proto.jspb.test.Simple2; + hasAString(): boolean; + getARepeatedStringList(): string[]; + setARepeatedStringList(value: string[]): proto.jspb.test.Simple2; + addARepeatedString(value: string, index?: number): proto.jspb.test.Simple2; + clearARepeatedStringList(): proto.jspb.test.Simple2; + } + + export class SpecialCases extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.SpecialCases): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.SpecialCases; + static deserializeBinaryFromReader(msg: proto.jspb.test.SpecialCases, reader: jspb.BinaryReader): proto.jspb.test.SpecialCases; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.SpecialCases, writer: jspb.BinaryWriter): void; + getNormal(): string; + setNormal(value: string): proto.jspb.test.SpecialCases; + clearNormal(): proto.jspb.test.SpecialCases; + hasNormal(): boolean; + getDefault(): string; + setDefault(value: string): proto.jspb.test.SpecialCases; + clearDefault(): proto.jspb.test.SpecialCases; + hasDefault(): boolean; + getFunction(): string; + setFunction(value: string): proto.jspb.test.SpecialCases; + clearFunction(): proto.jspb.test.SpecialCases; + hasFunction(): boolean; + getVar(): string; + setVar(value: string): proto.jspb.test.SpecialCases; + clearVar(): proto.jspb.test.SpecialCases; + hasVar(): boolean; + } + + export class OptionalFields extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.OptionalFields): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.OptionalFields; + static deserializeBinaryFromReader(msg: proto.jspb.test.OptionalFields, reader: jspb.BinaryReader): proto.jspb.test.OptionalFields; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.OptionalFields, writer: jspb.BinaryWriter): void; + export class Nested extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.OptionalFields.Nested): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.OptionalFields.Nested; + static deserializeBinaryFromReader(msg: proto.jspb.test.OptionalFields.Nested, reader: jspb.BinaryReader): proto.jspb.test.OptionalFields.Nested; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.OptionalFields.Nested, writer: jspb.BinaryWriter): void; + getAnInt(): number; + setAnInt(value: number): proto.jspb.test.OptionalFields.Nested; + clearAnInt(): proto.jspb.test.OptionalFields.Nested; + hasAnInt(): boolean; + } + + getAString(): string; + setAString(value: string): proto.jspb.test.OptionalFields; + clearAString(): proto.jspb.test.OptionalFields; + hasAString(): boolean; + getABool(): boolean; + setABool(value: boolean): proto.jspb.test.OptionalFields; + clearABool(): proto.jspb.test.OptionalFields; + hasABool(): boolean; + getANestedMessage(): proto.jspb.test.OptionalFields.Nested | null; + setANestedMessage(value: proto.jspb.test.OptionalFields.Nested | null | undefined): proto.jspb.test.OptionalFields; + clearANestedMessage(): proto.jspb.test.OptionalFields; + hasANestedMessage(): boolean; + getARepeatedMessageList(): proto.jspb.test.OptionalFields.Nested[]; + setARepeatedMessageList(value: proto.jspb.test.OptionalFields.Nested[]): proto.jspb.test.OptionalFields; + addARepeatedMessage(value?: proto.jspb.test.OptionalFields.Nested, index?: number): proto.jspb.test.OptionalFields.Nested; + clearARepeatedMessageList(): proto.jspb.test.OptionalFields; + getARepeatedStringList(): string[]; + setARepeatedStringList(value: string[]): proto.jspb.test.OptionalFields; + addARepeatedString(value: string, index?: number): proto.jspb.test.OptionalFields; + clearARepeatedStringList(): proto.jspb.test.OptionalFields; + } + + export class HasExtensions extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.HasExtensions): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.HasExtensions; + static deserializeBinaryFromReader(msg: proto.jspb.test.HasExtensions, reader: jspb.BinaryReader): proto.jspb.test.HasExtensions; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.HasExtensions, writer: jspb.BinaryWriter): void; + getStr1(): string; + setStr1(value: string): proto.jspb.test.HasExtensions; + clearStr1(): proto.jspb.test.HasExtensions; + hasStr1(): boolean; + getStr2(): string; + setStr2(value: string): proto.jspb.test.HasExtensions; + clearStr2(): proto.jspb.test.HasExtensions; + hasStr2(): boolean; + getStr3(): string; + setStr3(value: string): proto.jspb.test.HasExtensions; + clearStr3(): proto.jspb.test.HasExtensions; + hasStr3(): boolean; + } + + export class Complex extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Complex): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Complex; + static deserializeBinaryFromReader(msg: proto.jspb.test.Complex, reader: jspb.BinaryReader): proto.jspb.test.Complex; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.Complex, writer: jspb.BinaryWriter): void; + export class Nested extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Complex.Nested): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Complex.Nested; + static deserializeBinaryFromReader(msg: proto.jspb.test.Complex.Nested, reader: jspb.BinaryReader): proto.jspb.test.Complex.Nested; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.Complex.Nested, writer: jspb.BinaryWriter): void; + getAnInt(): number; + setAnInt(value: number): proto.jspb.test.Complex.Nested; + clearAnInt(): proto.jspb.test.Complex.Nested; + hasAnInt(): boolean; + } + + getAString(): string; + setAString(value: string): proto.jspb.test.Complex; + clearAString(): proto.jspb.test.Complex; + hasAString(): boolean; + getAnOutOfOrderBool(): boolean; + setAnOutOfOrderBool(value: boolean): proto.jspb.test.Complex; + clearAnOutOfOrderBool(): proto.jspb.test.Complex; + hasAnOutOfOrderBool(): boolean; + getANestedMessage(): proto.jspb.test.Complex.Nested | null; + setANestedMessage(value: proto.jspb.test.Complex.Nested | null | undefined): proto.jspb.test.Complex; + clearANestedMessage(): proto.jspb.test.Complex; + hasANestedMessage(): boolean; + getARepeatedMessageList(): proto.jspb.test.Complex.Nested[]; + setARepeatedMessageList(value: proto.jspb.test.Complex.Nested[]): proto.jspb.test.Complex; + addARepeatedMessage(value?: proto.jspb.test.Complex.Nested, index?: number): proto.jspb.test.Complex.Nested; + clearARepeatedMessageList(): proto.jspb.test.Complex; + getARepeatedStringList(): string[]; + setARepeatedStringList(value: string[]): proto.jspb.test.Complex; + addARepeatedString(value: string, index?: number): proto.jspb.test.Complex; + clearARepeatedStringList(): proto.jspb.test.Complex; + getAFloatingPointField(): number; + setAFloatingPointField(value: number): proto.jspb.test.Complex; + clearAFloatingPointField(): proto.jspb.test.Complex; + hasAFloatingPointField(): boolean; + } + + export class OuterMessage extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.OuterMessage): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.OuterMessage; + static deserializeBinaryFromReader(msg: proto.jspb.test.OuterMessage, reader: jspb.BinaryReader): proto.jspb.test.OuterMessage; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.OuterMessage, writer: jspb.BinaryWriter): void; + export class Complex extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.OuterMessage.Complex): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.OuterMessage.Complex; + static deserializeBinaryFromReader(msg: proto.jspb.test.OuterMessage.Complex, reader: jspb.BinaryReader): proto.jspb.test.OuterMessage.Complex; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.OuterMessage.Complex, writer: jspb.BinaryWriter): void; + getInnerComplexField(): number; + setInnerComplexField(value: number): proto.jspb.test.OuterMessage.Complex; + clearInnerComplexField(): proto.jspb.test.OuterMessage.Complex; + hasInnerComplexField(): boolean; + } + + } + + export class MineField extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.MineField): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.MineField; + static deserializeBinaryFromReader(msg: proto.jspb.test.MineField, reader: jspb.BinaryReader): proto.jspb.test.MineField; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.MineField, writer: jspb.BinaryWriter): void; + getCookie(): string; + setCookie(value: string): proto.jspb.test.MineField; + clearCookie(): proto.jspb.test.MineField; + hasCookie(): boolean; + } + + export class IsExtension extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.IsExtension): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.IsExtension; + static deserializeBinaryFromReader(msg: proto.jspb.test.IsExtension, reader: jspb.BinaryReader): proto.jspb.test.IsExtension; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.IsExtension, writer: jspb.BinaryWriter): void; + getExt1(): string; + setExt1(value: string): proto.jspb.test.IsExtension; + clearExt1(): proto.jspb.test.IsExtension; + hasExt1(): boolean; + } + + export class IndirectExtension extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.IndirectExtension): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.IndirectExtension; + static deserializeBinaryFromReader(msg: proto.jspb.test.IndirectExtension, reader: jspb.BinaryReader): proto.jspb.test.IndirectExtension; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.IndirectExtension, writer: jspb.BinaryWriter): void; + } + + export class DefaultValues extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.DefaultValues): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.DefaultValues; + static deserializeBinaryFromReader(msg: proto.jspb.test.DefaultValues, reader: jspb.BinaryReader): proto.jspb.test.DefaultValues; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.DefaultValues, writer: jspb.BinaryWriter): void; + enum Enum { + E1 = 13, + E2 = 77, + } + + getStringField(): string; + setStringField(value: string): proto.jspb.test.DefaultValues; + clearStringField(): proto.jspb.test.DefaultValues; + hasStringField(): boolean; + getBoolField(): boolean; + setBoolField(value: boolean): proto.jspb.test.DefaultValues; + clearBoolField(): proto.jspb.test.DefaultValues; + hasBoolField(): boolean; + getIntField(): number; + setIntField(value: number): proto.jspb.test.DefaultValues; + clearIntField(): proto.jspb.test.DefaultValues; + hasIntField(): boolean; + getEnumField(): proto.jspb.test.DefaultValues.Enum; + setEnumField(value: proto.jspb.test.DefaultValues.Enum): proto.jspb.test.DefaultValues; + clearEnumField(): proto.jspb.test.DefaultValues; + hasEnumField(): boolean; + getEmptyField(): string; + setEmptyField(value: string): proto.jspb.test.DefaultValues; + clearEmptyField(): proto.jspb.test.DefaultValues; + hasEmptyField(): boolean; + getBytesField(): (string|Uint8Array); + getBytesField_asB64(): string; + getBytesField_asU8(): Uint8Array; + setBytesField(value: (string|Uint8Array)): proto.jspb.test.DefaultValues; + clearBytesField(): proto.jspb.test.DefaultValues; + hasBytesField(): boolean; + } + + export class FloatingPointFields extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.FloatingPointFields): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.FloatingPointFields; + static deserializeBinaryFromReader(msg: proto.jspb.test.FloatingPointFields, reader: jspb.BinaryReader): proto.jspb.test.FloatingPointFields; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.FloatingPointFields, writer: jspb.BinaryWriter): void; + getOptionalFloatField(): number; + setOptionalFloatField(value: number): proto.jspb.test.FloatingPointFields; + clearOptionalFloatField(): proto.jspb.test.FloatingPointFields; + hasOptionalFloatField(): boolean; + getRequiredFloatField(): number; + setRequiredFloatField(value: number): proto.jspb.test.FloatingPointFields; + clearRequiredFloatField(): proto.jspb.test.FloatingPointFields; + hasRequiredFloatField(): boolean; + getRepeatedFloatFieldList(): number[]; + setRepeatedFloatFieldList(value: number[]): proto.jspb.test.FloatingPointFields; + addRepeatedFloatField(value: number, index?: number): proto.jspb.test.FloatingPointFields; + clearRepeatedFloatFieldList(): proto.jspb.test.FloatingPointFields; + getDefaultFloatField(): number; + setDefaultFloatField(value: number): proto.jspb.test.FloatingPointFields; + clearDefaultFloatField(): proto.jspb.test.FloatingPointFields; + hasDefaultFloatField(): boolean; + getOptionalDoubleField(): number; + setOptionalDoubleField(value: number): proto.jspb.test.FloatingPointFields; + clearOptionalDoubleField(): proto.jspb.test.FloatingPointFields; + hasOptionalDoubleField(): boolean; + getRequiredDoubleField(): number; + setRequiredDoubleField(value: number): proto.jspb.test.FloatingPointFields; + clearRequiredDoubleField(): proto.jspb.test.FloatingPointFields; + hasRequiredDoubleField(): boolean; + getRepeatedDoubleFieldList(): number[]; + setRepeatedDoubleFieldList(value: number[]): proto.jspb.test.FloatingPointFields; + addRepeatedDoubleField(value: number, index?: number): proto.jspb.test.FloatingPointFields; + clearRepeatedDoubleFieldList(): proto.jspb.test.FloatingPointFields; + getDefaultDoubleField(): number; + setDefaultDoubleField(value: number): proto.jspb.test.FloatingPointFields; + clearDefaultDoubleField(): proto.jspb.test.FloatingPointFields; + hasDefaultDoubleField(): boolean; + } + + export class BooleanFields extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.BooleanFields): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.BooleanFields; + static deserializeBinaryFromReader(msg: proto.jspb.test.BooleanFields, reader: jspb.BinaryReader): proto.jspb.test.BooleanFields; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.BooleanFields, writer: jspb.BinaryWriter): void; + getOptionalBooleanField(): boolean; + setOptionalBooleanField(value: boolean): proto.jspb.test.BooleanFields; + clearOptionalBooleanField(): proto.jspb.test.BooleanFields; + hasOptionalBooleanField(): boolean; + getRequiredBooleanField(): boolean; + setRequiredBooleanField(value: boolean): proto.jspb.test.BooleanFields; + clearRequiredBooleanField(): proto.jspb.test.BooleanFields; + hasRequiredBooleanField(): boolean; + getRepeatedBooleanFieldList(): boolean[]; + setRepeatedBooleanFieldList(value: boolean[]): proto.jspb.test.BooleanFields; + addRepeatedBooleanField(value: boolean, index?: number): proto.jspb.test.BooleanFields; + clearRepeatedBooleanFieldList(): proto.jspb.test.BooleanFields; + getDefaultBooleanField(): boolean; + setDefaultBooleanField(value: boolean): proto.jspb.test.BooleanFields; + clearDefaultBooleanField(): proto.jspb.test.BooleanFields; + hasDefaultBooleanField(): boolean; + } + + export class TestClone extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestClone): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestClone; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestClone, reader: jspb.BinaryReader): proto.jspb.test.TestClone; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestClone, writer: jspb.BinaryWriter): void; + getStr(): string; + setStr(value: string): proto.jspb.test.TestClone; + clearStr(): proto.jspb.test.TestClone; + hasStr(): boolean; + getSimple1(): proto.jspb.test.Simple1 | null; + setSimple1(value: proto.jspb.test.Simple1 | null | undefined): proto.jspb.test.TestClone; + clearSimple1(): proto.jspb.test.TestClone; + hasSimple1(): boolean; + getSimple2List(): proto.jspb.test.Simple1[]; + setSimple2List(value: proto.jspb.test.Simple1[]): proto.jspb.test.TestClone; + addSimple2(value?: proto.jspb.test.Simple1, index?: number): proto.jspb.test.Simple1; + clearSimple2List(): proto.jspb.test.TestClone; + getBytesField(): (string|Uint8Array); + getBytesField_asB64(): string; + getBytesField_asU8(): Uint8Array; + setBytesField(value: (string|Uint8Array)): proto.jspb.test.TestClone; + clearBytesField(): proto.jspb.test.TestClone; + hasBytesField(): boolean; + getUnused(): string; + setUnused(value: string): proto.jspb.test.TestClone; + clearUnused(): proto.jspb.test.TestClone; + hasUnused(): boolean; + } + + export class TestCloneExtension extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestCloneExtension): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestCloneExtension; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestCloneExtension, reader: jspb.BinaryReader): proto.jspb.test.TestCloneExtension; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestCloneExtension, writer: jspb.BinaryWriter): void; + getF(): number; + setF(value: number): proto.jspb.test.TestCloneExtension; + clearF(): proto.jspb.test.TestCloneExtension; + hasF(): boolean; + } + + export class CloneExtension extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.CloneExtension): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.CloneExtension; + static deserializeBinaryFromReader(msg: proto.jspb.test.CloneExtension, reader: jspb.BinaryReader): proto.jspb.test.CloneExtension; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.CloneExtension, writer: jspb.BinaryWriter): void; + getExt(): string; + setExt(value: string): proto.jspb.test.CloneExtension; + clearExt(): proto.jspb.test.CloneExtension; + hasExt(): boolean; + } + + export class TestGroup extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestGroup): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestGroup; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestGroup, reader: jspb.BinaryReader): proto.jspb.test.TestGroup; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestGroup, writer: jspb.BinaryWriter): void; + export class RepeatedGroup extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestGroup.RepeatedGroup): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestGroup.RepeatedGroup; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestGroup.RepeatedGroup, reader: jspb.BinaryReader): proto.jspb.test.TestGroup.RepeatedGroup; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestGroup.RepeatedGroup, writer: jspb.BinaryWriter): void; + getId(): string; + setId(value: string): proto.jspb.test.TestGroup.RepeatedGroup; + clearId(): proto.jspb.test.TestGroup.RepeatedGroup; + hasId(): boolean; + getSomeBoolList(): boolean[]; + setSomeBoolList(value: boolean[]): proto.jspb.test.TestGroup.RepeatedGroup; + addSomeBool(value: boolean, index?: number): proto.jspb.test.TestGroup.RepeatedGroup; + clearSomeBoolList(): proto.jspb.test.TestGroup.RepeatedGroup; + } + + export class RequiredGroup extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestGroup.RequiredGroup): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestGroup.RequiredGroup; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestGroup.RequiredGroup, reader: jspb.BinaryReader): proto.jspb.test.TestGroup.RequiredGroup; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestGroup.RequiredGroup, writer: jspb.BinaryWriter): void; + getId(): string; + setId(value: string): proto.jspb.test.TestGroup.RequiredGroup; + clearId(): proto.jspb.test.TestGroup.RequiredGroup; + hasId(): boolean; + } + + export class OptionalGroup extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestGroup.OptionalGroup): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestGroup.OptionalGroup; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestGroup.OptionalGroup, reader: jspb.BinaryReader): proto.jspb.test.TestGroup.OptionalGroup; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestGroup.OptionalGroup, writer: jspb.BinaryWriter): void; + getId(): string; + setId(value: string): proto.jspb.test.TestGroup.OptionalGroup; + clearId(): proto.jspb.test.TestGroup.OptionalGroup; + hasId(): boolean; + } + + getRepeatedGroupList(): proto.jspb.test.TestGroup.RepeatedGroup[]; + setRepeatedGroupList(value: proto.jspb.test.TestGroup.RepeatedGroup[]): proto.jspb.test.TestGroup; + addRepeatedGroup(value?: proto.jspb.test.TestGroup.RepeatedGroup, index?: number): proto.jspb.test.TestGroup.RepeatedGroup; + clearRepeatedGroupList(): proto.jspb.test.TestGroup; + getRequiredGroup(): proto.jspb.test.TestGroup.RequiredGroup; + setRequiredGroup(value: proto.jspb.test.TestGroup.RequiredGroup): proto.jspb.test.TestGroup; + clearRequiredGroup(): proto.jspb.test.TestGroup; + hasRequiredGroup(): boolean; + getOptionalGroup(): proto.jspb.test.TestGroup.OptionalGroup | null; + setOptionalGroup(value: proto.jspb.test.TestGroup.OptionalGroup | null | undefined): proto.jspb.test.TestGroup; + clearOptionalGroup(): proto.jspb.test.TestGroup; + hasOptionalGroup(): boolean; + getId(): string; + setId(value: string): proto.jspb.test.TestGroup; + clearId(): proto.jspb.test.TestGroup; + hasId(): boolean; + getRequiredSimple(): proto.jspb.test.Simple2; + setRequiredSimple(value: proto.jspb.test.Simple2): proto.jspb.test.TestGroup; + clearRequiredSimple(): proto.jspb.test.TestGroup; + hasRequiredSimple(): boolean; + getOptionalSimple(): proto.jspb.test.Simple2 | null; + setOptionalSimple(value: proto.jspb.test.Simple2 | null | undefined): proto.jspb.test.TestGroup; + clearOptionalSimple(): proto.jspb.test.TestGroup; + hasOptionalSimple(): boolean; + } + + export class TestGroup1 extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestGroup1): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestGroup1; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestGroup1, reader: jspb.BinaryReader): proto.jspb.test.TestGroup1; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestGroup1, writer: jspb.BinaryWriter): void; + getGroup(): proto.jspb.test.TestGroup.RepeatedGroup | null; + setGroup(value: proto.jspb.test.TestGroup.RepeatedGroup | null | undefined): proto.jspb.test.TestGroup1; + clearGroup(): proto.jspb.test.TestGroup1; + hasGroup(): boolean; + } + + export class TestReservedNames extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestReservedNames): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestReservedNames; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestReservedNames, reader: jspb.BinaryReader): proto.jspb.test.TestReservedNames; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestReservedNames, writer: jspb.BinaryWriter): void; + getExtension$(): number; + setExtension$(value: number): proto.jspb.test.TestReservedNames; + clearExtension$(): proto.jspb.test.TestReservedNames; + hasExtension$(): boolean; + } + + export class TestReservedNamesExtension extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestReservedNamesExtension): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestReservedNamesExtension; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestReservedNamesExtension, reader: jspb.BinaryReader): proto.jspb.test.TestReservedNamesExtension; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestReservedNamesExtension, writer: jspb.BinaryWriter): void; + } + + export class TestMessageWithOneof extends jspb.Message { + constructor(data?: any[] | null); + enum PartialOneofCase = { + PARTIAL_ONEOF_NOT_SET: 0, + PONE: 3, + PTHREE: 5, + }; + getPartialOneofCase(): proto.jspb.test.TestMessageWithOneof.PartialOneofCase; + enum RecursiveOneofCase = { + RECURSIVE_ONEOF_NOT_SET: 0, + RONE: 6, + RTWO: 7, + }; + getRecursiveOneofCase(): proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase; + enum DefaultOneofACase = { + DEFAULT_ONEOF_A_NOT_SET: 0, + AONE: 10, + ATWO: 11, + }; + getDefaultOneofACase(): proto.jspb.test.TestMessageWithOneof.DefaultOneofACase; + enum DefaultOneofBCase = { + DEFAULT_ONEOF_B_NOT_SET: 0, + BONE: 12, + BTWO: 13, + }; + getDefaultOneofBCase(): proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase; + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestMessageWithOneof): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestMessageWithOneof; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestMessageWithOneof, reader: jspb.BinaryReader): proto.jspb.test.TestMessageWithOneof; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestMessageWithOneof, writer: jspb.BinaryWriter): void; + getPone(): string; + setPone(value: string): proto.jspb.test.TestMessageWithOneof; + clearPone(): proto.jspb.test.TestMessageWithOneof; + hasPone(): boolean; + getPthree(): string; + setPthree(value: string): proto.jspb.test.TestMessageWithOneof; + clearPthree(): proto.jspb.test.TestMessageWithOneof; + hasPthree(): boolean; + getRone(): proto.jspb.test.TestMessageWithOneof | null; + setRone(value: proto.jspb.test.TestMessageWithOneof | null | undefined): proto.jspb.test.TestMessageWithOneof; + clearRone(): proto.jspb.test.TestMessageWithOneof; + hasRone(): boolean; + getRtwo(): string; + setRtwo(value: string): proto.jspb.test.TestMessageWithOneof; + clearRtwo(): proto.jspb.test.TestMessageWithOneof; + hasRtwo(): boolean; + getNormalField(): boolean; + setNormalField(value: boolean): proto.jspb.test.TestMessageWithOneof; + clearNormalField(): proto.jspb.test.TestMessageWithOneof; + hasNormalField(): boolean; + getRepeatedFieldList(): string[]; + setRepeatedFieldList(value: string[]): proto.jspb.test.TestMessageWithOneof; + addRepeatedField(value: string, index?: number): proto.jspb.test.TestMessageWithOneof; + clearRepeatedFieldList(): proto.jspb.test.TestMessageWithOneof; + getAone(): number; + setAone(value: number): proto.jspb.test.TestMessageWithOneof; + clearAone(): proto.jspb.test.TestMessageWithOneof; + hasAone(): boolean; + getAtwo(): number; + setAtwo(value: number): proto.jspb.test.TestMessageWithOneof; + clearAtwo(): proto.jspb.test.TestMessageWithOneof; + hasAtwo(): boolean; + getBone(): number; + setBone(value: number): proto.jspb.test.TestMessageWithOneof; + clearBone(): proto.jspb.test.TestMessageWithOneof; + hasBone(): boolean; + getBtwo(): number; + setBtwo(value: number): proto.jspb.test.TestMessageWithOneof; + clearBtwo(): proto.jspb.test.TestMessageWithOneof; + hasBtwo(): boolean; + } + + export class TestEndsWithBytes extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestEndsWithBytes): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestEndsWithBytes; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestEndsWithBytes, reader: jspb.BinaryReader): proto.jspb.test.TestEndsWithBytes; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestEndsWithBytes, writer: jspb.BinaryWriter): void; + getValue(): number; + setValue(value: number): proto.jspb.test.TestEndsWithBytes; + clearValue(): proto.jspb.test.TestEndsWithBytes; + hasValue(): boolean; + getData(): (string|Uint8Array); + getData_asB64(): string; + getData_asU8(): Uint8Array; + setData(value: (string|Uint8Array)): proto.jspb.test.TestEndsWithBytes; + clearData(): proto.jspb.test.TestEndsWithBytes; + hasData(): boolean; + } + + export class TestLastFieldBeforePivot extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestLastFieldBeforePivot): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestLastFieldBeforePivot; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestLastFieldBeforePivot, reader: jspb.BinaryReader): proto.jspb.test.TestLastFieldBeforePivot; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestLastFieldBeforePivot, writer: jspb.BinaryWriter): void; + getLastFieldBeforePivot(): number; + setLastFieldBeforePivot(value: number): proto.jspb.test.TestLastFieldBeforePivot; + clearLastFieldBeforePivot(): proto.jspb.test.TestLastFieldBeforePivot; + hasLastFieldBeforePivot(): boolean; + } + + export class Int64Types extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Int64Types): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Int64Types; + static deserializeBinaryFromReader(msg: proto.jspb.test.Int64Types, reader: jspb.BinaryReader): proto.jspb.test.Int64Types; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.Int64Types, writer: jspb.BinaryWriter): void; + getInt64Normal(): number; + setInt64Normal(value: number): proto.jspb.test.Int64Types; + clearInt64Normal(): proto.jspb.test.Int64Types; + hasInt64Normal(): boolean; + getInt64String(): string; + setInt64String(value: string): proto.jspb.test.Int64Types; + clearInt64String(): proto.jspb.test.Int64Types; + hasInt64String(): boolean; + getInt64Number(): number; + setInt64Number(value: number): proto.jspb.test.Int64Types; + clearInt64Number(): proto.jspb.test.Int64Types; + hasInt64Number(): boolean; + } + + export class TestMapFieldsNoBinary extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestMapFieldsNoBinary): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestMapFieldsNoBinary; + static deserializeBinaryFromReader(msg: proto.jspb.test.TestMapFieldsNoBinary, reader: jspb.BinaryReader): proto.jspb.test.TestMapFieldsNoBinary; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.TestMapFieldsNoBinary, writer: jspb.BinaryWriter): void; + getMapStringStringMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringStringMap(): proto.jspb.test.TestMapFieldsNoBinary; + getMapStringInt32Map(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringInt32Map(): proto.jspb.test.TestMapFieldsNoBinary; + getMapStringInt64Map(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringInt64Map(): proto.jspb.test.TestMapFieldsNoBinary; + getMapStringBoolMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringBoolMap(): proto.jspb.test.TestMapFieldsNoBinary; + getMapStringDoubleMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringDoubleMap(): proto.jspb.test.TestMapFieldsNoBinary; + getMapStringEnumMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringEnumMap(): proto.jspb.test.TestMapFieldsNoBinary; + getMapStringMsgMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringMsgMap(): proto.jspb.test.TestMapFieldsNoBinary; + getMapInt32StringMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapInt32StringMap(): proto.jspb.test.TestMapFieldsNoBinary; + getMapInt64StringMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapInt64StringMap(): proto.jspb.test.TestMapFieldsNoBinary; + getMapBoolStringMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapBoolStringMap(): proto.jspb.test.TestMapFieldsNoBinary; + getTestMapFields(): proto.jspb.test.TestMapFieldsNoBinary | null; + setTestMapFields(value: proto.jspb.test.TestMapFieldsNoBinary | null | undefined): proto.jspb.test.TestMapFieldsNoBinary; + clearTestMapFields(): proto.jspb.test.TestMapFieldsNoBinary; + hasTestMapFields(): boolean; + getMapStringTestmapfieldsMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringTestmapfieldsMap(): proto.jspb.test.TestMapFieldsNoBinary; + } + + export class MapValueMessageNoBinary extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.MapValueMessageNoBinary): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.MapValueMessageNoBinary; + static deserializeBinaryFromReader(msg: proto.jspb.test.MapValueMessageNoBinary, reader: jspb.BinaryReader): proto.jspb.test.MapValueMessageNoBinary; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.MapValueMessageNoBinary, writer: jspb.BinaryWriter): void; + getFoo(): number; + setFoo(value: number): proto.jspb.test.MapValueMessageNoBinary; + clearFoo(): proto.jspb.test.MapValueMessageNoBinary; + hasFoo(): boolean; + } + + export class Deeply extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Deeply): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Deeply; + static deserializeBinaryFromReader(msg: proto.jspb.test.Deeply, reader: jspb.BinaryReader): proto.jspb.test.Deeply; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.Deeply, writer: jspb.BinaryWriter): void; + export class Nested extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Deeply.Nested): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Deeply.Nested; + static deserializeBinaryFromReader(msg: proto.jspb.test.Deeply.Nested, reader: jspb.BinaryReader): proto.jspb.test.Deeply.Nested; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.Deeply.Nested, writer: jspb.BinaryWriter): void; + export class Message extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): GlobalObject; + static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Deeply.Nested.Message): GlobalObject; + static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Deeply.Nested.Message; + static deserializeBinaryFromReader(msg: proto.jspb.test.Deeply.Nested.Message, reader: jspb.BinaryReader): proto.jspb.test.Deeply.Nested.Message; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: proto.jspb.test.Deeply.Nested.Message, writer: jspb.BinaryWriter): void; + getCount(): number; + setCount(value: number): proto.jspb.test.Deeply.Nested.Message; + clearCount(): proto.jspb.test.Deeply.Nested.Message; + hasCount(): boolean; + } + + } + + } + + enum OuterEnum { + FOO = 1, + BAR = 2, + } + + enum MapValueEnumNoBinary { + MAP_VALUE_FOO_NOBINARY = 0, + MAP_VALUE_BAR_NOBINARY = 1, + MAP_VALUE_BAZ_NOBINARY = 2, + } + + enum TestAllowAliasEnum { + TEST_ALLOW_ALIAS_DEFAULT = 0, + VALUE1 = 1, + } + +} + +declare module "goog:proto.jspb.test.BooleanFields " { + import BooleanFields = proto.jspb.test.BooleanFields; + export default BooleanFields; +} + +declare module "goog:proto.jspb.test.CloneExtension " { + import CloneExtension = proto.jspb.test.CloneExtension; + export default CloneExtension; +} + +declare module "goog:proto.jspb.test.Complex " { + import Complex = proto.jspb.test.Complex; + export default Complex; +} + +declare module "goog:proto.jspb.test.Deeply " { + import Deeply = proto.jspb.test.Deeply; + export default Deeply; +} + +declare module "goog:proto.jspb.test.DefaultValues " { + import DefaultValues = proto.jspb.test.DefaultValues; + export default DefaultValues; +} + +declare module "goog:proto.jspb.test.Empty " { + import Empty = proto.jspb.test.Empty; + export default Empty; +} + +declare module "goog:proto.jspb.test.EnumContainer " { + import EnumContainer = proto.jspb.test.EnumContainer; + export default EnumContainer; +} + +declare module "goog:proto.jspb.test.FloatingPointFields " { + import FloatingPointFields = proto.jspb.test.FloatingPointFields; + export default FloatingPointFields; +} + +declare module "goog:proto.jspb.test.HasExtensions " { + import HasExtensions = proto.jspb.test.HasExtensions; + export default HasExtensions; +} + +declare module "goog:proto.jspb.test.IndirectExtension " { + import IndirectExtension = proto.jspb.test.IndirectExtension; + export default IndirectExtension; +} + +declare module "goog:proto.jspb.test.Int64Types " { + import Int64Types = proto.jspb.test.Int64Types; + export default Int64Types; +} + +declare module "goog:proto.jspb.test.IsExtension " { + import IsExtension = proto.jspb.test.IsExtension; + export default IsExtension; +} + +declare module "goog:proto.jspb.test.MapValueEnumNoBinary " { + import MapValueEnumNoBinary = proto.jspb.test.MapValueEnumNoBinary; + export default MapValueEnumNoBinary; +} + +declare module "goog:proto.jspb.test.MapValueMessageNoBinary " { + import MapValueMessageNoBinary = proto.jspb.test.MapValueMessageNoBinary; + export default MapValueMessageNoBinary; +} + +declare module "goog:proto.jspb.test.MineField " { + import MineField = proto.jspb.test.MineField; + export default MineField; +} + +declare module "goog:proto.jspb.test.OptionalFields " { + import OptionalFields = proto.jspb.test.OptionalFields; + export default OptionalFields; +} + +declare module "goog:proto.jspb.test.OuterEnum " { + import OuterEnum = proto.jspb.test.OuterEnum; + export default OuterEnum; +} + +declare module "goog:proto.jspb.test.OuterMessage " { + import OuterMessage = proto.jspb.test.OuterMessage; + export default OuterMessage; +} + +declare module "goog:proto.jspb.test.Simple1 " { + import Simple1 = proto.jspb.test.Simple1; + export default Simple1; +} + +declare module "goog:proto.jspb.test.Simple2 " { + import Simple2 = proto.jspb.test.Simple2; + export default Simple2; +} + +declare module "goog:proto.jspb.test.SpecialCases " { + import SpecialCases = proto.jspb.test.SpecialCases; + export default SpecialCases; +} + +declare module "goog:proto.jspb.test.TestAllowAliasEnum " { + import TestAllowAliasEnum = proto.jspb.test.TestAllowAliasEnum; + export default TestAllowAliasEnum; +} + +declare module "goog:proto.jspb.test.TestClone " { + import TestClone = proto.jspb.test.TestClone; + export default TestClone; +} + +declare module "goog:proto.jspb.test.TestCloneExtension " { + import TestCloneExtension = proto.jspb.test.TestCloneExtension; + export default TestCloneExtension; +} + +declare module "goog:proto.jspb.test.TestEndsWithBytes " { + import TestEndsWithBytes = proto.jspb.test.TestEndsWithBytes; + export default TestEndsWithBytes; +} + +declare module "goog:proto.jspb.test.TestGroup " { + import TestGroup = proto.jspb.test.TestGroup; + export default TestGroup; +} + +declare module "goog:proto.jspb.test.TestGroup1 " { + import TestGroup1 = proto.jspb.test.TestGroup1; + export default TestGroup1; +} + +declare module "goog:proto.jspb.test.TestLastFieldBeforePivot " { + import TestLastFieldBeforePivot = proto.jspb.test.TestLastFieldBeforePivot; + export default TestLastFieldBeforePivot; +} + +declare module "goog:proto.jspb.test.TestMapFieldsNoBinary " { + import TestMapFieldsNoBinary = proto.jspb.test.TestMapFieldsNoBinary; + export default TestMapFieldsNoBinary; +} + +declare module "goog:proto.jspb.test.TestMessageWithOneof " { + import TestMessageWithOneof = proto.jspb.test.TestMessageWithOneof; + export default TestMessageWithOneof; +} + +declare module "goog:proto.jspb.test.TestReservedNames " { + import TestReservedNames = proto.jspb.test.TestReservedNames; + export default TestReservedNames; +} + +declare module "goog:proto.jspb.test.TestReservedNamesExtension " { + import TestReservedNamesExtension = proto.jspb.test.TestReservedNamesExtension; + export default TestReservedNamesExtension; +} + +import BooleanFields = proto.jspb.test.BooleanFields; +import CloneExtension = proto.jspb.test.CloneExtension; +import Complex = proto.jspb.test.Complex; +import Deeply = proto.jspb.test.Deeply; +import DefaultValues = proto.jspb.test.DefaultValues; +import Empty = proto.jspb.test.Empty; +import EnumContainer = proto.jspb.test.EnumContainer; +import FloatingPointFields = proto.jspb.test.FloatingPointFields; +import HasExtensions = proto.jspb.test.HasExtensions; +import IndirectExtension = proto.jspb.test.IndirectExtension; +import Int64Types = proto.jspb.test.Int64Types; +import IsExtension = proto.jspb.test.IsExtension; +import MapValueEnumNoBinary = proto.jspb.test.MapValueEnumNoBinary; +import MapValueMessageNoBinary = proto.jspb.test.MapValueMessageNoBinary; +import MineField = proto.jspb.test.MineField; +import OptionalFields = proto.jspb.test.OptionalFields; +import OuterEnum = proto.jspb.test.OuterEnum; +import OuterMessage = proto.jspb.test.OuterMessage; +import Simple1 = proto.jspb.test.Simple1; +import Simple2 = proto.jspb.test.Simple2; +import SpecialCases = proto.jspb.test.SpecialCases; +import TestAllowAliasEnum = proto.jspb.test.TestAllowAliasEnum; +import TestClone = proto.jspb.test.TestClone; +import TestCloneExtension = proto.jspb.test.TestCloneExtension; +import TestEndsWithBytes = proto.jspb.test.TestEndsWithBytes; +import TestGroup = proto.jspb.test.TestGroup; +import TestGroup1 = proto.jspb.test.TestGroup1; +import TestLastFieldBeforePivot = proto.jspb.test.TestLastFieldBeforePivot; +import TestMapFieldsNoBinary = proto.jspb.test.TestMapFieldsNoBinary; +import TestMessageWithOneof = proto.jspb.test.TestMessageWithOneof; +import TestReservedNames = proto.jspb.test.TestReservedNames; +import TestReservedNamesExtension = proto.jspb.test.TestReservedNamesExtension; + +export { + BooleanFields, + CloneExtension, + Complex, + Deeply, + DefaultValues, + Empty, + EnumContainer, + FloatingPointFields, + HasExtensions, + IndirectExtension, + Int64Types, + IsExtension, + MapValueEnumNoBinary, + MapValueMessageNoBinary, + MineField, + OptionalFields, + OuterEnum, + OuterMessage, + Simple1, + Simple2, + SpecialCases, + TestAllowAliasEnum, + TestClone, + TestCloneExtension, + TestEndsWithBytes, + TestGroup, + TestGroup1, + TestLastFieldBeforePivot, + TestMapFieldsNoBinary, + TestMessageWithOneof, + TestReservedNames, + TestReservedNamesExtension, +}; diff --git a/example/test.js b/example/test.js new file mode 100644 index 00000000..f73fc750 --- /dev/null +++ b/example/test.js @@ -0,0 +1,9993 @@ +// source: test.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +import * as jspb from 'google-protobuf'; +var goog = jspb; +var proto = {}; + +import * as google_protobuf_descriptor_pb from 'google-protobuf/google/protobuf/descriptor.js'; +goog.object.extend(proto, google_protobuf_descriptor_pb); +goog.exportSymbol('proto.jspb.test.BooleanFields', null, global); +goog.exportSymbol('proto.jspb.test.CloneExtension', null, global); +goog.exportSymbol('proto.jspb.test.Complex', null, global); +goog.exportSymbol('proto.jspb.test.Complex.Nested', null, global); +goog.exportSymbol('proto.jspb.test.Deeply', null, global); +goog.exportSymbol('proto.jspb.test.Deeply.Nested', null, global); +goog.exportSymbol('proto.jspb.test.Deeply.Nested.Message', null, global); +goog.exportSymbol('proto.jspb.test.DefaultValues', null, global); +goog.exportSymbol('proto.jspb.test.DefaultValues.Enum', null, global); +goog.exportSymbol('proto.jspb.test.Empty', null, global); +goog.exportSymbol('proto.jspb.test.EnumContainer', null, global); +goog.exportSymbol('proto.jspb.test.FloatingPointFields', null, global); +goog.exportSymbol('proto.jspb.test.HasExtensions', null, global); +goog.exportSymbol('proto.jspb.test.IndirectExtension', null, global); +goog.exportSymbol('proto.jspb.test.Int64Types', null, global); +goog.exportSymbol('proto.jspb.test.IsExtension', null, global); +goog.exportSymbol('proto.jspb.test.MapValueEnumNoBinary', null, global); +goog.exportSymbol('proto.jspb.test.MapValueMessageNoBinary', null, global); +goog.exportSymbol('proto.jspb.test.MineField', null, global); +goog.exportSymbol('proto.jspb.test.OptionalFields', null, global); +goog.exportSymbol('proto.jspb.test.OptionalFields.Nested', null, global); +goog.exportSymbol('proto.jspb.test.OuterEnum', null, global); +goog.exportSymbol('proto.jspb.test.OuterMessage', null, global); +goog.exportSymbol('proto.jspb.test.OuterMessage.Complex', null, global); +goog.exportSymbol('proto.jspb.test.Simple1', null, global); +goog.exportSymbol('proto.jspb.test.Simple2', null, global); +goog.exportSymbol('proto.jspb.test.SpecialCases', null, global); +goog.exportSymbol('proto.jspb.test.TestAllowAliasEnum', null, global); +goog.exportSymbol('proto.jspb.test.TestClone', null, global); +goog.exportSymbol('proto.jspb.test.TestCloneExtension', null, global); +goog.exportSymbol('proto.jspb.test.TestEndsWithBytes', null, global); +goog.exportSymbol('proto.jspb.test.TestGroup', null, global); +goog.exportSymbol('proto.jspb.test.TestGroup.OptionalGroup', null, global); +goog.exportSymbol('proto.jspb.test.TestGroup.RepeatedGroup', null, global); +goog.exportSymbol('proto.jspb.test.TestGroup.RequiredGroup', null, global); +goog.exportSymbol('proto.jspb.test.TestGroup1', null, global); +goog.exportSymbol('proto.jspb.test.TestLastFieldBeforePivot', null, global); +goog.exportSymbol('proto.jspb.test.TestMapFieldsNoBinary', null, global); +goog.exportSymbol('proto.jspb.test.TestMessageWithOneof', null, global); +goog.exportSymbol('proto.jspb.test.TestMessageWithOneof.DefaultOneofACase', null, global); +goog.exportSymbol('proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase', null, global); +goog.exportSymbol('proto.jspb.test.TestMessageWithOneof.PartialOneofCase', null, global); +goog.exportSymbol('proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase', null, global); +goog.exportSymbol('proto.jspb.test.TestReservedNames', null, global); +goog.exportSymbol('proto.jspb.test.TestReservedNamesExtension', null, global); +goog.exportSymbol('proto.jspb.test.extendTestLastFieldBeforePivotField', null, global); +goog.exportSymbol('proto.jspb.test.simple1', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Empty = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Empty, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Empty.displayName = 'proto.jspb.test.Empty'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.EnumContainer = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.EnumContainer, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.EnumContainer.displayName = 'proto.jspb.test.EnumContainer'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Simple1 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.Simple1.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.Simple1, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Simple1.displayName = 'proto.jspb.test.Simple1'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Simple2 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.Simple2.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.Simple2, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Simple2.displayName = 'proto.jspb.test.Simple2'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.SpecialCases = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.SpecialCases, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.SpecialCases.displayName = 'proto.jspb.test.SpecialCases'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.OptionalFields = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.OptionalFields.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.OptionalFields, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.OptionalFields.displayName = 'proto.jspb.test.OptionalFields'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.OptionalFields.Nested = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.OptionalFields.Nested, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.OptionalFields.Nested.displayName = 'proto.jspb.test.OptionalFields.Nested'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.HasExtensions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 4, null, null); +}; +goog.inherits(proto.jspb.test.HasExtensions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.HasExtensions.displayName = 'proto.jspb.test.HasExtensions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.HasExtensions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.HasExtensions.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Complex = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.Complex.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.Complex, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Complex.displayName = 'proto.jspb.test.Complex'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Complex.Nested = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Complex.Nested, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Complex.Nested.displayName = 'proto.jspb.test.Complex.Nested'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.OuterMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.OuterMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.OuterMessage.displayName = 'proto.jspb.test.OuterMessage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.OuterMessage.Complex = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.OuterMessage.Complex, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.OuterMessage.Complex.displayName = 'proto.jspb.test.OuterMessage.Complex'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.MineField = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.MineField, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.MineField.displayName = 'proto.jspb.test.MineField'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.IsExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.IsExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.IsExtension.displayName = 'proto.jspb.test.IsExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.IndirectExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.IndirectExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.IndirectExtension.displayName = 'proto.jspb.test.IndirectExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.DefaultValues = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.DefaultValues, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.DefaultValues.displayName = 'proto.jspb.test.DefaultValues'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.FloatingPointFields = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.FloatingPointFields.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.FloatingPointFields, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.FloatingPointFields.displayName = 'proto.jspb.test.FloatingPointFields'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.BooleanFields = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.BooleanFields.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.BooleanFields, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.BooleanFields.displayName = 'proto.jspb.test.BooleanFields'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestClone = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 8, proto.jspb.test.TestClone.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.TestClone, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestClone.displayName = 'proto.jspb.test.TestClone'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestClone.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestClone.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestCloneExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestCloneExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestCloneExtension.displayName = 'proto.jspb.test.TestCloneExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.CloneExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.CloneExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.CloneExtension.displayName = 'proto.jspb.test.CloneExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.TestGroup.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.TestGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup.displayName = 'proto.jspb.test.TestGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup.RepeatedGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.TestGroup.RepeatedGroup.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.TestGroup.RepeatedGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup.RepeatedGroup.displayName = 'proto.jspb.test.TestGroup.RepeatedGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup.RequiredGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestGroup.RequiredGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup.RequiredGroup.displayName = 'proto.jspb.test.TestGroup.RequiredGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup.OptionalGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestGroup.OptionalGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup.OptionalGroup.displayName = 'proto.jspb.test.TestGroup.OptionalGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup1 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestGroup1, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup1.displayName = 'proto.jspb.test.TestGroup1'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestReservedNames = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); +}; +goog.inherits(proto.jspb.test.TestReservedNames, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestReservedNames.displayName = 'proto.jspb.test.TestReservedNames'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestReservedNames.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestReservedNames.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestReservedNamesExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestReservedNamesExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestReservedNamesExtension.displayName = 'proto.jspb.test.TestReservedNamesExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestMessageWithOneof = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.TestMessageWithOneof.repeatedFields_, proto.jspb.test.TestMessageWithOneof.oneofGroups_); +}; +goog.inherits(proto.jspb.test.TestMessageWithOneof, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestMessageWithOneof.displayName = 'proto.jspb.test.TestMessageWithOneof'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestEndsWithBytes = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestEndsWithBytes, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestEndsWithBytes.displayName = 'proto.jspb.test.TestEndsWithBytes'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestLastFieldBeforePivot = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); +}; +goog.inherits(proto.jspb.test.TestLastFieldBeforePivot, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestLastFieldBeforePivot.displayName = 'proto.jspb.test.TestLastFieldBeforePivot'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestLastFieldBeforePivot.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Int64Types = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Int64Types, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Int64Types.displayName = 'proto.jspb.test.Int64Types'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestMapFieldsNoBinary = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestMapFieldsNoBinary, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestMapFieldsNoBinary.displayName = 'proto.jspb.test.TestMapFieldsNoBinary'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.MapValueMessageNoBinary = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.MapValueMessageNoBinary, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.MapValueMessageNoBinary.displayName = 'proto.jspb.test.MapValueMessageNoBinary'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Deeply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Deeply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Deeply.displayName = 'proto.jspb.test.Deeply'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Deeply.Nested = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Deeply.Nested, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Deeply.Nested.displayName = 'proto.jspb.test.Deeply.Nested'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Deeply.Nested.Message = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Deeply.Nested.Message, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Deeply.Nested.Message.displayName = 'proto.jspb.test.Deeply.Nested.Message'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Empty.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Empty.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Empty} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Empty.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Empty} + */ +proto.jspb.test.Empty.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Empty; + return proto.jspb.test.Empty.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Empty} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Empty} + */ +proto.jspb.test.Empty.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Empty.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Empty.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Empty} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Empty.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.EnumContainer.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.EnumContainer.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.EnumContainer} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.EnumContainer.toObject = function(includeInstance, msg) { + var f, obj = { +outerEnum: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.EnumContainer} + */ +proto.jspb.test.EnumContainer.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.EnumContainer; + return proto.jspb.test.EnumContainer.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.EnumContainer} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.EnumContainer} + */ +proto.jspb.test.EnumContainer.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.jspb.test.OuterEnum} */ (reader.readEnum()); + msg.setOuterEnum(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.EnumContainer.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.EnumContainer.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.EnumContainer} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.EnumContainer.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeEnum( + 1, + f + ); + } +}; + + +/** + * optional OuterEnum outer_enum = 1; + * @return {!proto.jspb.test.OuterEnum} + */ +proto.jspb.test.EnumContainer.prototype.getOuterEnum = function() { + return /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getFieldWithDefault(this, 1, 1)); +}; + + +/** + * @param {!proto.jspb.test.OuterEnum} value + * @return {!proto.jspb.test.EnumContainer} returns this + */ +proto.jspb.test.EnumContainer.prototype.setOuterEnum = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.EnumContainer} returns this + */ +proto.jspb.test.EnumContainer.prototype.clearOuterEnum = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.EnumContainer.prototype.hasOuterEnum = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.Simple1.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Simple1.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Simple1.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Simple1} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Simple1.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f, +aBoolean: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Simple1} + */ +proto.jspb.test.Simple1.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Simple1; + return proto.jspb.test.Simple1.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Simple1} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Simple1} + */ +proto.jspb.test.Simple1.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setABoolean(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Simple1.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Simple1.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Simple1} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Simple1.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeBool( + 3, + f + ); + } +}; + + +/** + * required string a_string = 1; + * @return {string} + */ +proto.jspb.test.Simple1.prototype.getAString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.setAString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.clearAString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Simple1.prototype.hasAString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated string a_repeated_string = 2; + * @return {!Array} + */ +proto.jspb.test.Simple1.prototype.getARepeatedStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.setARepeatedStringList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.addARepeatedString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.clearARepeatedStringList = function() { + return this.setARepeatedStringList([]); +}; + + +/** + * optional bool a_boolean = 3; + * @return {boolean} + */ +proto.jspb.test.Simple1.prototype.getABoolean = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.setABoolean = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.clearABoolean = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Simple1.prototype.hasABoolean = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.Simple2.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Simple2.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Simple2.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Simple2} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Simple2.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Simple2} + */ +proto.jspb.test.Simple2.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Simple2; + return proto.jspb.test.Simple2.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Simple2} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Simple2} + */ +proto.jspb.test.Simple2.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Simple2.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Simple2.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Simple2} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Simple2.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } +}; + + +/** + * required string a_string = 1; + * @return {string} + */ +proto.jspb.test.Simple2.prototype.getAString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.setAString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.clearAString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Simple2.prototype.hasAString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated string a_repeated_string = 2; + * @return {!Array} + */ +proto.jspb.test.Simple2.prototype.getARepeatedStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.setARepeatedStringList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.addARepeatedString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.clearARepeatedStringList = function() { + return this.setARepeatedStringList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.SpecialCases.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.SpecialCases.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.SpecialCases} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.SpecialCases.toObject = function(includeInstance, msg) { + var f, obj = { +normal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +pb_default: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, +pb_function: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, +pb_var: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.SpecialCases} + */ +proto.jspb.test.SpecialCases.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.SpecialCases; + return proto.jspb.test.SpecialCases.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.SpecialCases} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.SpecialCases} + */ +proto.jspb.test.SpecialCases.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setNormal(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDefault(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setFunction(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setVar(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.SpecialCases.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.SpecialCases.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.SpecialCases} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.SpecialCases.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeString( + 4, + f + ); + } +}; + + +/** + * required string normal = 1; + * @return {string} + */ +proto.jspb.test.SpecialCases.prototype.getNormal = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.setNormal = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.clearNormal = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.SpecialCases.prototype.hasNormal = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required string default = 2; + * @return {string} + */ +proto.jspb.test.SpecialCases.prototype.getDefault = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.setDefault = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.clearDefault = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.SpecialCases.prototype.hasDefault = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * required string function = 3; + * @return {string} + */ +proto.jspb.test.SpecialCases.prototype.getFunction = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.setFunction = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.clearFunction = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.SpecialCases.prototype.hasFunction = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * required string var = 4; + * @return {string} + */ +proto.jspb.test.SpecialCases.prototype.getVar = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.setVar = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.clearVar = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.SpecialCases.prototype.hasVar = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.OptionalFields.repeatedFields_ = [4,5]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.OptionalFields.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.OptionalFields.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OptionalFields} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OptionalFields.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +aBool: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, +aNestedMessage: (f = msg.getANestedMessage()) && proto.jspb.test.OptionalFields.Nested.toObject(includeInstance, f), +aRepeatedMessageList: jspb.Message.toObjectList(msg.getARepeatedMessageList(), + proto.jspb.test.OptionalFields.Nested.toObject, includeInstance), +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OptionalFields} + */ +proto.jspb.test.OptionalFields.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.OptionalFields; + return proto.jspb.test.OptionalFields.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OptionalFields} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OptionalFields} + */ +proto.jspb.test.OptionalFields.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setABool(value); + break; + case 3: + var value = new proto.jspb.test.OptionalFields.Nested; + reader.readMessage(value,proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader); + msg.setANestedMessage(value); + break; + case 4: + var value = new proto.jspb.test.OptionalFields.Nested; + reader.readMessage(value,proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader); + msg.addARepeatedMessage(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.OptionalFields.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.OptionalFields.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OptionalFields} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OptionalFields.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = message.getANestedMessage(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedMessageList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 5, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.OptionalFields.Nested.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.OptionalFields.Nested.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OptionalFields.Nested} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OptionalFields.Nested.toObject = function(includeInstance, msg) { + var f, obj = { +anInt: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OptionalFields.Nested} + */ +proto.jspb.test.OptionalFields.Nested.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.OptionalFields.Nested; + return proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OptionalFields.Nested} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OptionalFields.Nested} + */ +proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAnInt(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.OptionalFields.Nested.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OptionalFields.Nested} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 an_int = 1; + * @return {number} + */ +proto.jspb.test.OptionalFields.Nested.prototype.getAnInt = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.OptionalFields.Nested} returns this + */ +proto.jspb.test.OptionalFields.Nested.prototype.setAnInt = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OptionalFields.Nested} returns this + */ +proto.jspb.test.OptionalFields.Nested.prototype.clearAnInt = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OptionalFields.Nested.prototype.hasAnInt = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string a_string = 1; + * @return {string} + */ +proto.jspb.test.OptionalFields.prototype.getAString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.setAString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearAString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OptionalFields.prototype.hasAString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required bool a_bool = 2; + * @return {boolean} + */ +proto.jspb.test.OptionalFields.prototype.getABool = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.setABool = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearABool = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OptionalFields.prototype.hasABool = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional Nested a_nested_message = 3; + * @return {?proto.jspb.test.OptionalFields.Nested} + */ +proto.jspb.test.OptionalFields.prototype.getANestedMessage = function() { + return /** @type{?proto.jspb.test.OptionalFields.Nested} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.OptionalFields.Nested, 3)); +}; + + +/** + * @param {?proto.jspb.test.OptionalFields.Nested|undefined} value + * @return {!proto.jspb.test.OptionalFields} returns this +*/ +proto.jspb.test.OptionalFields.prototype.setANestedMessage = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearANestedMessage = function() { + return this.setANestedMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OptionalFields.prototype.hasANestedMessage = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated Nested a_repeated_message = 4; + * @return {!Array} + */ +proto.jspb.test.OptionalFields.prototype.getARepeatedMessageList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.OptionalFields.Nested, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.OptionalFields} returns this +*/ +proto.jspb.test.OptionalFields.prototype.setARepeatedMessageList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.jspb.test.OptionalFields.Nested=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.OptionalFields.Nested} + */ +proto.jspb.test.OptionalFields.prototype.addARepeatedMessage = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.jspb.test.OptionalFields.Nested, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearARepeatedMessageList = function() { + return this.setARepeatedMessageList([]); +}; + + +/** + * repeated string a_repeated_string = 5; + * @return {!Array} + */ +proto.jspb.test.OptionalFields.prototype.getARepeatedStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.setARepeatedStringList = function(value) { + return jspb.Message.setField(this, 5, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.addARepeatedString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 5, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearARepeatedStringList = function() { + return this.setARepeatedStringList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.HasExtensions.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.HasExtensions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.HasExtensions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.HasExtensions.toObject = function(includeInstance, msg) { + var f, obj = { +str1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +str2: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, +str3: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.HasExtensions.extensions, proto.jspb.test.HasExtensions.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.HasExtensions} + */ +proto.jspb.test.HasExtensions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.HasExtensions; + return proto.jspb.test.HasExtensions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.HasExtensions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.HasExtensions} + */ +proto.jspb.test.HasExtensions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStr1(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setStr2(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setStr3(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.HasExtensions.extensionsBinary, + proto.jspb.test.HasExtensions.prototype.getExtension, + proto.jspb.test.HasExtensions.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.HasExtensions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.HasExtensions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.HasExtensions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.HasExtensions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.HasExtensions.extensionsBinary, proto.jspb.test.HasExtensions.prototype.getExtension); +}; + + +/** + * optional string str1 = 1; + * @return {string} + */ +proto.jspb.test.HasExtensions.prototype.getStr1 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.setStr1 = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.clearStr1 = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.HasExtensions.prototype.hasStr1 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string str2 = 2; + * @return {string} + */ +proto.jspb.test.HasExtensions.prototype.getStr2 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.setStr2 = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.clearStr2 = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.HasExtensions.prototype.hasStr2 = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional string str3 = 3; + * @return {string} + */ +proto.jspb.test.HasExtensions.prototype.getStr3 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.setStr3 = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.clearStr3 = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.HasExtensions.prototype.hasStr3 = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.Complex.repeatedFields_ = [5,7]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Complex.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Complex.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Complex} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Complex.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +anOutOfOrderBool: (f = jspb.Message.getBooleanField(msg, 9)) == null ? undefined : f, +aNestedMessage: (f = msg.getANestedMessage()) && proto.jspb.test.Complex.Nested.toObject(includeInstance, f), +aRepeatedMessageList: jspb.Message.toObjectList(msg.getARepeatedMessageList(), + proto.jspb.test.Complex.Nested.toObject, includeInstance), +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 7)) == null ? undefined : f, +aFloatingPointField: (f = jspb.Message.getOptionalFloatingPointField(msg, 10)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Complex} + */ +proto.jspb.test.Complex.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Complex; + return proto.jspb.test.Complex.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Complex} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Complex} + */ +proto.jspb.test.Complex.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 9: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAnOutOfOrderBool(value); + break; + case 4: + var value = new proto.jspb.test.Complex.Nested; + reader.readMessage(value,proto.jspb.test.Complex.Nested.deserializeBinaryFromReader); + msg.setANestedMessage(value); + break; + case 5: + var value = new proto.jspb.test.Complex.Nested; + reader.readMessage(value,proto.jspb.test.Complex.Nested.deserializeBinaryFromReader); + msg.addARepeatedMessage(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + case 10: + var value = /** @type {number} */ (reader.readDouble()); + msg.setAFloatingPointField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Complex.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Complex.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Complex} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Complex.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 9)); + if (f != null) { + writer.writeBool( + 9, + f + ); + } + f = message.getANestedMessage(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.jspb.test.Complex.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedMessageList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + proto.jspb.test.Complex.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 7, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeDouble( + 10, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Complex.Nested.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Complex.Nested.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Complex.Nested} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Complex.Nested.toObject = function(includeInstance, msg) { + var f, obj = { +anInt: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Complex.Nested} + */ +proto.jspb.test.Complex.Nested.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Complex.Nested; + return proto.jspb.test.Complex.Nested.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Complex.Nested} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Complex.Nested} + */ +proto.jspb.test.Complex.Nested.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAnInt(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Complex.Nested.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Complex.Nested.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Complex.Nested} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Complex.Nested.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeInt32( + 2, + f + ); + } +}; + + +/** + * required int32 an_int = 2; + * @return {number} + */ +proto.jspb.test.Complex.Nested.prototype.getAnInt = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Complex.Nested} returns this + */ +proto.jspb.test.Complex.Nested.prototype.setAnInt = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex.Nested} returns this + */ +proto.jspb.test.Complex.Nested.prototype.clearAnInt = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.Nested.prototype.hasAnInt = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * required string a_string = 1; + * @return {string} + */ +proto.jspb.test.Complex.prototype.getAString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.setAString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearAString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.hasAString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bool an_out_of_order_bool = 9; + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.getAnOutOfOrderBool = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.setAnOutOfOrderBool = function(value) { + return jspb.Message.setField(this, 9, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearAnOutOfOrderBool = function() { + return jspb.Message.setField(this, 9, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.hasAnOutOfOrderBool = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional Nested a_nested_message = 4; + * @return {?proto.jspb.test.Complex.Nested} + */ +proto.jspb.test.Complex.prototype.getANestedMessage = function() { + return /** @type{?proto.jspb.test.Complex.Nested} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Complex.Nested, 4)); +}; + + +/** + * @param {?proto.jspb.test.Complex.Nested|undefined} value + * @return {!proto.jspb.test.Complex} returns this +*/ +proto.jspb.test.Complex.prototype.setANestedMessage = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearANestedMessage = function() { + return this.setANestedMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.hasANestedMessage = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * repeated Nested a_repeated_message = 5; + * @return {!Array} + */ +proto.jspb.test.Complex.prototype.getARepeatedMessageList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.Complex.Nested, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.Complex} returns this +*/ +proto.jspb.test.Complex.prototype.setARepeatedMessageList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 5, value); +}; + + +/** + * @param {!proto.jspb.test.Complex.Nested=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.Complex.Nested} + */ +proto.jspb.test.Complex.prototype.addARepeatedMessage = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.jspb.test.Complex.Nested, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearARepeatedMessageList = function() { + return this.setARepeatedMessageList([]); +}; + + +/** + * repeated string a_repeated_string = 7; + * @return {!Array} + */ +proto.jspb.test.Complex.prototype.getARepeatedStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 7)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.setARepeatedStringList = function(value) { + return jspb.Message.setField(this, 7, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.addARepeatedString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 7, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearARepeatedStringList = function() { + return this.setARepeatedStringList([]); +}; + + +/** + * optional double a_floating_point_field = 10; + * @return {number} + */ +proto.jspb.test.Complex.prototype.getAFloatingPointField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 10, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.setAFloatingPointField = function(value) { + return jspb.Message.setField(this, 10, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearAFloatingPointField = function() { + return jspb.Message.setField(this, 10, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.hasAFloatingPointField = function() { + return jspb.Message.getField(this, 10) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.OuterMessage.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.OuterMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OuterMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OuterMessage.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OuterMessage} + */ +proto.jspb.test.OuterMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.OuterMessage; + return proto.jspb.test.OuterMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OuterMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OuterMessage} + */ +proto.jspb.test.OuterMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.OuterMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.OuterMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OuterMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OuterMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.OuterMessage.Complex.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.OuterMessage.Complex.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OuterMessage.Complex} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OuterMessage.Complex.toObject = function(includeInstance, msg) { + var f, obj = { +innerComplexField: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OuterMessage.Complex} + */ +proto.jspb.test.OuterMessage.Complex.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.OuterMessage.Complex; + return proto.jspb.test.OuterMessage.Complex.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OuterMessage.Complex} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OuterMessage.Complex} + */ +proto.jspb.test.OuterMessage.Complex.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setInnerComplexField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.OuterMessage.Complex.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.OuterMessage.Complex.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OuterMessage.Complex} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OuterMessage.Complex.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 inner_complex_field = 1; + * @return {number} + */ +proto.jspb.test.OuterMessage.Complex.prototype.getInnerComplexField = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.OuterMessage.Complex} returns this + */ +proto.jspb.test.OuterMessage.Complex.prototype.setInnerComplexField = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OuterMessage.Complex} returns this + */ +proto.jspb.test.OuterMessage.Complex.prototype.clearInnerComplexField = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OuterMessage.Complex.prototype.hasInnerComplexField = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.MineField.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.MineField.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.MineField} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.MineField.toObject = function(includeInstance, msg) { + var f, obj = { +cookie: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.MineField} + */ +proto.jspb.test.MineField.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.MineField; + return proto.jspb.test.MineField.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.MineField} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.MineField} + */ +proto.jspb.test.MineField.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setCookie(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.MineField.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.MineField.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.MineField} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.MineField.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string cookie = 1; + * @return {string} + */ +proto.jspb.test.MineField.prototype.getCookie = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.MineField} returns this + */ +proto.jspb.test.MineField.prototype.setCookie = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.MineField} returns this + */ +proto.jspb.test.MineField.prototype.clearCookie = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.MineField.prototype.hasCookie = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.IsExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.IsExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.IsExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.IsExtension.toObject = function(includeInstance, msg) { + var f, obj = { +ext1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.IsExtension} + */ +proto.jspb.test.IsExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.IsExtension; + return proto.jspb.test.IsExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.IsExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.IsExtension} + */ +proto.jspb.test.IsExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setExt1(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.IsExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.IsExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.IsExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.IsExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IsExtension.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + proto.jspb.test.IsExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.IsExtension.toObject), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IsExtension.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.IsExtension.serializeBinaryToWriter, + proto.jspb.test.IsExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[100] = proto.jspb.test.IsExtension.extField; + +/** + * optional string ext1 = 1; + * @return {string} + */ +proto.jspb.test.IsExtension.prototype.getExt1 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.IsExtension} returns this + */ +proto.jspb.test.IsExtension.prototype.setExt1 = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.IsExtension} returns this + */ +proto.jspb.test.IsExtension.prototype.clearExt1 = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.IsExtension.prototype.hasExt1 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IsExtension.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + proto.jspb.test.IsExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.IsExtension.toObject), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IsExtension.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.IsExtension.serializeBinaryToWriter, + proto.jspb.test.IsExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[100] = proto.jspb.test.IsExtension.extField; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `simpleOption`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IsExtension.simpleOption = new jspb.ExtensionFieldInfo( + 42113038, + {simpleOption: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +google_protobuf_descriptor_pb.EnumOptions.extensionsBinary[42113038] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IsExtension.simpleOption, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +google_protobuf_descriptor_pb.EnumOptions.extensions[42113038] = proto.jspb.test.IsExtension.simpleOption; + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.IndirectExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.IndirectExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.IndirectExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.IndirectExtension.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.IndirectExtension} + */ +proto.jspb.test.IndirectExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.IndirectExtension; + return proto.jspb.test.IndirectExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.IndirectExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.IndirectExtension} + */ +proto.jspb.test.IndirectExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.IndirectExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.IndirectExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.IndirectExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.IndirectExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `simple`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IndirectExtension.simple = new jspb.ExtensionFieldInfo( + 101, + {simple: 0}, + proto.jspb.test.Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.Simple1.toObject), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.simple, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.Simple1.serializeBinaryToWriter, + proto.jspb.test.Simple1.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[101] = proto.jspb.test.IndirectExtension.simple; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `str`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IndirectExtension.str = new jspb.ExtensionFieldInfo( + 102, + {str: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.str, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[102] = proto.jspb.test.IndirectExtension.str; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `repeatedStrList`. + * @type {!jspb.ExtensionFieldInfo>} + */ +proto.jspb.test.IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( + 103, + {repeatedStrList: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 1); + +proto.jspb.test.HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.repeatedStrList, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeRepeatedString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[103] = proto.jspb.test.IndirectExtension.repeatedStrList; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `repeatedSimpleList`. + * @type {!jspb.ExtensionFieldInfo>} + */ +proto.jspb.test.IndirectExtension.repeatedSimpleList = new jspb.ExtensionFieldInfo( + 104, + {repeatedSimpleList: 0}, + proto.jspb.test.Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.Simple1.toObject), + 1); + +proto.jspb.test.HasExtensions.extensionsBinary[104] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.repeatedSimpleList, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeRepeatedMessage, + proto.jspb.test.Simple1.serializeBinaryToWriter, + proto.jspb.test.Simple1.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[104] = proto.jspb.test.IndirectExtension.repeatedSimpleList; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `simple`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IndirectExtension.simple = new jspb.ExtensionFieldInfo( + 101, + {simple: 0}, + proto.jspb.test.Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.Simple1.toObject), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.simple, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.Simple1.serializeBinaryToWriter, + proto.jspb.test.Simple1.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[101] = proto.jspb.test.IndirectExtension.simple; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `str`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IndirectExtension.str = new jspb.ExtensionFieldInfo( + 102, + {str: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.str, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[102] = proto.jspb.test.IndirectExtension.str; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `repeatedStrList`. + * @type {!jspb.ExtensionFieldInfo>} + */ +proto.jspb.test.IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( + 103, + {repeatedStrList: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 1); + +proto.jspb.test.HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.repeatedStrList, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeRepeatedString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[103] = proto.jspb.test.IndirectExtension.repeatedStrList; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `repeatedSimpleList`. + * @type {!jspb.ExtensionFieldInfo>} + */ +proto.jspb.test.IndirectExtension.repeatedSimpleList = new jspb.ExtensionFieldInfo( + 104, + {repeatedSimpleList: 0}, + proto.jspb.test.Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.Simple1.toObject), + 1); + +proto.jspb.test.HasExtensions.extensionsBinary[104] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.repeatedSimpleList, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeRepeatedMessage, + proto.jspb.test.Simple1.serializeBinaryToWriter, + proto.jspb.test.Simple1.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[104] = proto.jspb.test.IndirectExtension.repeatedSimpleList; + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.DefaultValues.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.DefaultValues.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.DefaultValues} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.DefaultValues.toObject = function(includeInstance, msg) { + var f, obj = { +stringField: jspb.Message.getFieldWithDefault(msg, 1, "default\x3c\x3e\x27\x22abc"), +boolField: jspb.Message.getBooleanFieldWithDefault(msg, 2, true), +intField: jspb.Message.getFieldWithDefault(msg, 3, 11), +enumField: jspb.Message.getFieldWithDefault(msg, 4, 13), +emptyField: jspb.Message.getFieldWithDefault(msg, 6, ""), +bytesField: msg.getBytesField_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.DefaultValues} + */ +proto.jspb.test.DefaultValues.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.DefaultValues; + return proto.jspb.test.DefaultValues.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.DefaultValues} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.DefaultValues} + */ +proto.jspb.test.DefaultValues.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStringField(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setBoolField(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setIntField(value); + break; + case 4: + var value = /** @type {!proto.jspb.test.DefaultValues.Enum} */ (reader.readEnum()); + msg.setEnumField(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setEmptyField(value); + break; + case 8: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBytesField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.DefaultValues.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.DefaultValues.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.DefaultValues} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.DefaultValues.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeInt64( + 3, + f + ); + } + f = /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeEnum( + 4, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeString( + 6, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeBytes( + 8, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.jspb.test.DefaultValues.Enum = { + E1: 13, + E2: 77 +}; + +/** + * optional string string_field = 1; + * @return {string} + */ +proto.jspb.test.DefaultValues.prototype.getStringField = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "default\x3c\x3e\x27\x22abc")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setStringField = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearStringField = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasStringField = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bool bool_field = 2; + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.getBoolField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, true)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setBoolField = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearBoolField = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasBoolField = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional int64 int_field = 3; + * @return {number} + */ +proto.jspb.test.DefaultValues.prototype.getIntField = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 11)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setIntField = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearIntField = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasIntField = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional Enum enum_field = 4; + * @return {!proto.jspb.test.DefaultValues.Enum} + */ +proto.jspb.test.DefaultValues.prototype.getEnumField = function() { + return /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getFieldWithDefault(this, 4, 13)); +}; + + +/** + * @param {!proto.jspb.test.DefaultValues.Enum} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setEnumField = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearEnumField = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasEnumField = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional string empty_field = 6; + * @return {string} + */ +proto.jspb.test.DefaultValues.prototype.getEmptyField = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setEmptyField = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearEmptyField = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasEmptyField = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional bytes bytes_field = 8; + * @return {!(string|Uint8Array)} + */ +proto.jspb.test.DefaultValues.prototype.getBytesField = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 8, "bW9v")); +}; + + +/** + * optional bytes bytes_field = 8; + * This is a type-conversion wrapper around `getBytesField()` + * @return {string} + */ +proto.jspb.test.DefaultValues.prototype.getBytesField_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBytesField())); +}; + + +/** + * optional bytes bytes_field = 8; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBytesField()` + * @return {!Uint8Array} + */ +proto.jspb.test.DefaultValues.prototype.getBytesField_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBytesField())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setBytesField = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearBytesField = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasBytesField = function() { + return jspb.Message.getField(this, 8) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.FloatingPointFields.repeatedFields_ = [3,7]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.FloatingPointFields.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.FloatingPointFields.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.FloatingPointFields} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.FloatingPointFields.toObject = function(includeInstance, msg) { + var f, obj = { +optionalFloatField: (f = jspb.Message.getOptionalFloatingPointField(msg, 1)) == null ? undefined : f, +requiredFloatField: (f = jspb.Message.getOptionalFloatingPointField(msg, 2)) == null ? undefined : f, +repeatedFloatFieldList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 3)) == null ? undefined : f, +defaultFloatField: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 2.0), +optionalDoubleField: (f = jspb.Message.getOptionalFloatingPointField(msg, 5)) == null ? undefined : f, +requiredDoubleField: (f = jspb.Message.getOptionalFloatingPointField(msg, 6)) == null ? undefined : f, +repeatedDoubleFieldList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 7)) == null ? undefined : f, +defaultDoubleField: jspb.Message.getFloatingPointFieldWithDefault(msg, 8, 2.0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.FloatingPointFields} + */ +proto.jspb.test.FloatingPointFields.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.FloatingPointFields; + return proto.jspb.test.FloatingPointFields.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.FloatingPointFields} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.FloatingPointFields} + */ +proto.jspb.test.FloatingPointFields.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readFloat()); + msg.setOptionalFloatField(value); + break; + case 2: + var value = /** @type {number} */ (reader.readFloat()); + msg.setRequiredFloatField(value); + break; + case 3: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readFloat() : [reader.readFloat()]); + for (var i = 0; i < values.length; i++) { + msg.addRepeatedFloatField(values[i]); + } + break; + case 4: + var value = /** @type {number} */ (reader.readFloat()); + msg.setDefaultFloatField(value); + break; + case 5: + var value = /** @type {number} */ (reader.readDouble()); + msg.setOptionalDoubleField(value); + break; + case 6: + var value = /** @type {number} */ (reader.readDouble()); + msg.setRequiredDoubleField(value); + break; + case 7: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readDouble() : [reader.readDouble()]); + for (var i = 0; i < values.length; i++) { + msg.addRepeatedDoubleField(values[i]); + } + break; + case 8: + var value = /** @type {number} */ (reader.readDouble()); + msg.setDefaultDoubleField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.FloatingPointFields.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.FloatingPointFields.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.FloatingPointFields} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.FloatingPointFields.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeFloat( + 1, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeFloat( + 2, + f + ); + } + f = message.getRepeatedFloatFieldList(); + if (f.length > 0) { + writer.writeRepeatedFloat( + 3, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeFloat( + 4, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeDouble( + 5, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeDouble( + 6, + f + ); + } + f = message.getRepeatedDoubleFieldList(); + if (f.length > 0) { + writer.writeRepeatedDouble( + 7, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeDouble( + 8, + f + ); + } +}; + + +/** + * optional float optional_float_field = 1; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getOptionalFloatField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setOptionalFloatField = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearOptionalFloatField = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasOptionalFloatField = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required float required_float_field = 2; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getRequiredFloatField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setRequiredFloatField = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearRequiredFloatField = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasRequiredFloatField = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * repeated float repeated_float_field = 3; + * @return {!Array} + */ +proto.jspb.test.FloatingPointFields.prototype.getRepeatedFloatFieldList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setRepeatedFloatFieldList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.addRepeatedFloatField = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearRepeatedFloatFieldList = function() { + return this.setRepeatedFloatFieldList([]); +}; + + +/** + * optional float default_float_field = 4; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getDefaultFloatField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 2.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setDefaultFloatField = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearDefaultFloatField = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasDefaultFloatField = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional double optional_double_field = 5; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getOptionalDoubleField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setOptionalDoubleField = function(value) { + return jspb.Message.setField(this, 5, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearOptionalDoubleField = function() { + return jspb.Message.setField(this, 5, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasOptionalDoubleField = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * required double required_double_field = 6; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getRequiredDoubleField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 6, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setRequiredDoubleField = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearRequiredDoubleField = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasRequiredDoubleField = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * repeated double repeated_double_field = 7; + * @return {!Array} + */ +proto.jspb.test.FloatingPointFields.prototype.getRepeatedDoubleFieldList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 7)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setRepeatedDoubleFieldList = function(value) { + return jspb.Message.setField(this, 7, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.addRepeatedDoubleField = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 7, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearRepeatedDoubleFieldList = function() { + return this.setRepeatedDoubleFieldList([]); +}; + + +/** + * optional double default_double_field = 8; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getDefaultDoubleField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 8, 2.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setDefaultDoubleField = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearDefaultDoubleField = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasDefaultDoubleField = function() { + return jspb.Message.getField(this, 8) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.BooleanFields.repeatedFields_ = [3]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.BooleanFields.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.BooleanFields.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.BooleanFields} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.BooleanFields.toObject = function(includeInstance, msg) { + var f, obj = { +optionalBooleanField: (f = jspb.Message.getBooleanField(msg, 1)) == null ? undefined : f, +requiredBooleanField: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, +repeatedBooleanFieldList: (f = jspb.Message.getRepeatedBooleanField(msg, 3)) == null ? undefined : f, +defaultBooleanField: jspb.Message.getBooleanFieldWithDefault(msg, 4, true) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.BooleanFields} + */ +proto.jspb.test.BooleanFields.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.BooleanFields; + return proto.jspb.test.BooleanFields.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.BooleanFields} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.BooleanFields} + */ +proto.jspb.test.BooleanFields.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOptionalBooleanField(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setRequiredBooleanField(value); + break; + case 3: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readBool() : [reader.readBool()]); + for (var i = 0; i < values.length; i++) { + msg.addRepeatedBooleanField(values[i]); + } + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDefaultBooleanField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.BooleanFields.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.BooleanFields.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.BooleanFields} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.BooleanFields.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {boolean} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeBool( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = message.getRepeatedBooleanFieldList(); + if (f.length > 0) { + writer.writeRepeatedBool( + 3, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeBool( + 4, + f + ); + } +}; + + +/** + * optional bool optional_boolean_field = 1; + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.getOptionalBooleanField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.setOptionalBooleanField = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.clearOptionalBooleanField = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.hasOptionalBooleanField = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required bool required_boolean_field = 2; + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.getRequiredBooleanField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.setRequiredBooleanField = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.clearRequiredBooleanField = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.hasRequiredBooleanField = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * repeated bool repeated_boolean_field = 3; + * @return {!Array} + */ +proto.jspb.test.BooleanFields.prototype.getRepeatedBooleanFieldList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.setRepeatedBooleanFieldList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {boolean} value + * @param {number=} opt_index + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.addRepeatedBooleanField = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.clearRepeatedBooleanFieldList = function() { + return this.setRepeatedBooleanFieldList([]); +}; + + +/** + * optional bool default_boolean_field = 4; + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.getDefaultBooleanField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, true)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.setDefaultBooleanField = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.clearDefaultBooleanField = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.hasDefaultBooleanField = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.TestClone.repeatedFields_ = [5]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestClone.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestClone.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestClone} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestClone.toObject = function(includeInstance, msg) { + var f, obj = { +str: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +simple1: (f = msg.getSimple1()) && proto.jspb.test.Simple1.toObject(includeInstance, f), +simple2List: jspb.Message.toObjectList(msg.getSimple2List(), + proto.jspb.test.Simple1.toObject, includeInstance), +bytesField: msg.getBytesField_asB64(), +unused: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.TestClone.extensions, proto.jspb.test.TestClone.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestClone} + */ +proto.jspb.test.TestClone.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestClone; + return proto.jspb.test.TestClone.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestClone} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestClone} + */ +proto.jspb.test.TestClone.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStr(value); + break; + case 3: + var value = new proto.jspb.test.Simple1; + reader.readMessage(value,proto.jspb.test.Simple1.deserializeBinaryFromReader); + msg.setSimple1(value); + break; + case 5: + var value = new proto.jspb.test.Simple1; + reader.readMessage(value,proto.jspb.test.Simple1.deserializeBinaryFromReader); + msg.addSimple2(value); + break; + case 6: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBytesField(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setUnused(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.TestClone.extensionsBinary, + proto.jspb.test.TestClone.prototype.getExtension, + proto.jspb.test.TestClone.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestClone.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestClone.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestClone} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestClone.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getSimple1(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.jspb.test.Simple1.serializeBinaryToWriter + ); + } + f = message.getSimple2List(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + proto.jspb.test.Simple1.serializeBinaryToWriter + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeBytes( + 6, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeString( + 7, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.TestClone.extensionsBinary, proto.jspb.test.TestClone.prototype.getExtension); +}; + + +/** + * optional string str = 1; + * @return {string} + */ +proto.jspb.test.TestClone.prototype.getStr = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.setStr = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearStr = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestClone.prototype.hasStr = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Simple1 simple1 = 3; + * @return {?proto.jspb.test.Simple1} + */ +proto.jspb.test.TestClone.prototype.getSimple1 = function() { + return /** @type{?proto.jspb.test.Simple1} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Simple1, 3)); +}; + + +/** + * @param {?proto.jspb.test.Simple1|undefined} value + * @return {!proto.jspb.test.TestClone} returns this +*/ +proto.jspb.test.TestClone.prototype.setSimple1 = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearSimple1 = function() { + return this.setSimple1(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestClone.prototype.hasSimple1 = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated Simple1 simple2 = 5; + * @return {!Array} + */ +proto.jspb.test.TestClone.prototype.getSimple2List = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.Simple1, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.TestClone} returns this +*/ +proto.jspb.test.TestClone.prototype.setSimple2List = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 5, value); +}; + + +/** + * @param {!proto.jspb.test.Simple1=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.Simple1} + */ +proto.jspb.test.TestClone.prototype.addSimple2 = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.jspb.test.Simple1, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearSimple2List = function() { + return this.setSimple2List([]); +}; + + +/** + * optional bytes bytes_field = 6; + * @return {!(string|Uint8Array)} + */ +proto.jspb.test.TestClone.prototype.getBytesField = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * optional bytes bytes_field = 6; + * This is a type-conversion wrapper around `getBytesField()` + * @return {string} + */ +proto.jspb.test.TestClone.prototype.getBytesField_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBytesField())); +}; + + +/** + * optional bytes bytes_field = 6; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBytesField()` + * @return {!Uint8Array} + */ +proto.jspb.test.TestClone.prototype.getBytesField_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBytesField())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.setBytesField = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearBytesField = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestClone.prototype.hasBytesField = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional string unused = 7; + * @return {string} + */ +proto.jspb.test.TestClone.prototype.getUnused = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.setUnused = function(value) { + return jspb.Message.setField(this, 7, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearUnused = function() { + return jspb.Message.setField(this, 7, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestClone.prototype.hasUnused = function() { + return jspb.Message.getField(this, 7) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestCloneExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestCloneExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestCloneExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestCloneExtension.toObject = function(includeInstance, msg) { + var f, obj = { +f: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestCloneExtension} + */ +proto.jspb.test.TestCloneExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestCloneExtension; + return proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestCloneExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestCloneExtension} + */ +proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setF(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestCloneExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestCloneExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestCloneExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestCloneExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `lowExt`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.TestCloneExtension.lowExt = new jspb.ExtensionFieldInfo( + 11, + {lowExt: 0}, + proto.jspb.test.TestCloneExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.TestCloneExtension.toObject), + 0); + +proto.jspb.test.TestClone.extensionsBinary[11] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.TestCloneExtension.lowExt, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.TestCloneExtension.serializeBinaryToWriter, + proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestClone.extensions[11] = proto.jspb.test.TestCloneExtension.lowExt; + +/** + * optional int32 f = 1; + * @return {number} + */ +proto.jspb.test.TestCloneExtension.prototype.getF = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestCloneExtension} returns this + */ +proto.jspb.test.TestCloneExtension.prototype.setF = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestCloneExtension} returns this + */ +proto.jspb.test.TestCloneExtension.prototype.clearF = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestCloneExtension.prototype.hasF = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `lowExt`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.TestCloneExtension.lowExt = new jspb.ExtensionFieldInfo( + 11, + {lowExt: 0}, + proto.jspb.test.TestCloneExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.TestCloneExtension.toObject), + 0); + +proto.jspb.test.TestClone.extensionsBinary[11] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.TestCloneExtension.lowExt, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.TestCloneExtension.serializeBinaryToWriter, + proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestClone.extensions[11] = proto.jspb.test.TestCloneExtension.lowExt; + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.CloneExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.CloneExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.CloneExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.CloneExtension.toObject = function(includeInstance, msg) { + var f, obj = { +ext: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.CloneExtension} + */ +proto.jspb.test.CloneExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.CloneExtension; + return proto.jspb.test.CloneExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.CloneExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.CloneExtension} + */ +proto.jspb.test.CloneExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setExt(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.CloneExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.CloneExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.CloneExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.CloneExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.CloneExtension.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + proto.jspb.test.CloneExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.CloneExtension.toObject), + 0); + +proto.jspb.test.TestClone.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.CloneExtension.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.CloneExtension.serializeBinaryToWriter, + proto.jspb.test.CloneExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestClone.extensions[100] = proto.jspb.test.CloneExtension.extField; + +/** + * optional string ext = 2; + * @return {string} + */ +proto.jspb.test.CloneExtension.prototype.getExt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.CloneExtension} returns this + */ +proto.jspb.test.CloneExtension.prototype.setExt = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.CloneExtension} returns this + */ +proto.jspb.test.CloneExtension.prototype.clearExt = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.CloneExtension.prototype.hasExt = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.CloneExtension.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + proto.jspb.test.CloneExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.CloneExtension.toObject), + 0); + +proto.jspb.test.TestClone.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.CloneExtension.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.CloneExtension.serializeBinaryToWriter, + proto.jspb.test.CloneExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestClone.extensions[100] = proto.jspb.test.CloneExtension.extField; + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.TestGroup.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.toObject = function(includeInstance, msg) { + var f, obj = { +repeatedGroupList: jspb.Message.toObjectList(msg.getRepeatedGroupList(), + proto.jspb.test.TestGroup.RepeatedGroup.toObject, includeInstance), +requiredGroup: (f = msg.getRequiredGroup()) && proto.jspb.test.TestGroup.RequiredGroup.toObject(includeInstance, f), +optionalGroup: (f = msg.getOptionalGroup()) && proto.jspb.test.TestGroup.OptionalGroup.toObject(includeInstance, f), +id: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f, +requiredSimple: (f = msg.getRequiredSimple()) && proto.jspb.test.Simple2.toObject(includeInstance, f), +optionalSimple: (f = msg.getOptionalSimple()) && proto.jspb.test.Simple2.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup} + */ +proto.jspb.test.TestGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup; + return proto.jspb.test.TestGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup} + */ +proto.jspb.test.TestGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.jspb.test.TestGroup.RepeatedGroup; + reader.readGroup(1, value,proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader); + msg.addRepeatedGroup(value); + break; + case 2: + var value = new proto.jspb.test.TestGroup.RequiredGroup; + reader.readGroup(2, value,proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader); + msg.setRequiredGroup(value); + break; + case 3: + var value = new proto.jspb.test.TestGroup.OptionalGroup; + reader.readGroup(3, value,proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader); + msg.setOptionalGroup(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 5: + var value = new proto.jspb.test.Simple2; + reader.readMessage(value,proto.jspb.test.Simple2.deserializeBinaryFromReader); + msg.setRequiredSimple(value); + break; + case 6: + var value = new proto.jspb.test.Simple2; + reader.readMessage(value,proto.jspb.test.Simple2.deserializeBinaryFromReader); + msg.setOptionalSimple(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getRepeatedGroupList(); + if (f.length > 0) { + writer.writeRepeatedGroup( + 1, + f, + proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter + ); + } + f = message.getRequiredGroup(); + if (f != null) { + writer.writeGroup( + 2, + f, + proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter + ); + } + f = message.getOptionalGroup(); + if (f != null) { + writer.writeGroup( + 3, + f, + proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeString( + 4, + f + ); + } + f = message.getRequiredSimple(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.jspb.test.Simple2.serializeBinaryToWriter + ); + } + f = message.getOptionalSimple(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.jspb.test.Simple2.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.TestGroup.RepeatedGroup.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup.RepeatedGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.RepeatedGroup.toObject = function(includeInstance, msg) { + var f, obj = { +id: (f = jspb.Message.getField(msg, 0)) == null ? undefined : f, +someBoolList: (f = jspb.Message.getRepeatedBooleanField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + */ +proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup.RepeatedGroup; + return proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + */ +proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 2: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readBool() : [reader.readBool()]); + for (var i = 0; i < values.length; i++) { + msg.addSomeBool(values[i]); + } + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 0)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getSomeBoolList(); + if (f.length > 0) { + writer.writeRepeatedBool( + 2, + f + ); + } +}; + + +/** + * required string id = 1; + * @return {string} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 0, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.setId = function(value) { + return jspb.Message.setField(this, 0, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.clearId = function() { + return jspb.Message.setField(this, 0, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.hasId = function() { + return jspb.Message.getField(this, 0) != null; +}; + + +/** + * repeated bool some_bool = 2; + * @return {!Array} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.getSomeBoolList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.setSomeBoolList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {boolean} value + * @param {number=} opt_index + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.addSomeBool = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.clearSomeBoolList = function() { + return this.setSomeBoolList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup.RequiredGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup.RequiredGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.RequiredGroup.toObject = function(includeInstance, msg) { + var f, obj = { +id: (f = jspb.Message.getField(msg, -1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup.RequiredGroup} + */ +proto.jspb.test.TestGroup.RequiredGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup.RequiredGroup; + return proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup.RequiredGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup.RequiredGroup} + */ +proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup.RequiredGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, -1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * required string id = 1; + * @return {string} + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, -1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.setId = function(value) { + return jspb.Message.setField(this, -1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.clearId = function() { + return jspb.Message.setField(this, -1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.hasId = function() { + return jspb.Message.getField(this, -1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup.OptionalGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup.OptionalGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.OptionalGroup.toObject = function(includeInstance, msg) { + var f, obj = { +id: (f = jspb.Message.getField(msg, -2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup.OptionalGroup} + */ +proto.jspb.test.TestGroup.OptionalGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup.OptionalGroup; + return proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup.OptionalGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup.OptionalGroup} + */ +proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup.OptionalGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, -2)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * required string id = 1; + * @return {string} + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, -2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.setId = function(value) { + return jspb.Message.setField(this, -2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.clearId = function() { + return jspb.Message.setField(this, -2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.hasId = function() { + return jspb.Message.getField(this, -2) != null; +}; + + +/** + * repeated group RepeatedGroup = 1; + * @return {!Array} + */ +proto.jspb.test.TestGroup.prototype.getRepeatedGroupList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.TestGroup.RepeatedGroup, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setRepeatedGroupList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.jspb.test.TestGroup.RepeatedGroup=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + */ +proto.jspb.test.TestGroup.prototype.addRepeatedGroup = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.jspb.test.TestGroup.RepeatedGroup, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearRepeatedGroupList = function() { + return this.setRepeatedGroupList([]); +}; + + +/** + * required group RequiredGroup = 2; + * @return {!proto.jspb.test.TestGroup.RequiredGroup} + */ +proto.jspb.test.TestGroup.prototype.getRequiredGroup = function() { + return /** @type{!proto.jspb.test.TestGroup.RequiredGroup} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestGroup.RequiredGroup, 2, 1)); +}; + + +/** + * @param {!proto.jspb.test.TestGroup.RequiredGroup} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setRequiredGroup = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearRequiredGroup = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasRequiredGroup = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional group OptionalGroup = 3; + * @return {?proto.jspb.test.TestGroup.OptionalGroup} + */ +proto.jspb.test.TestGroup.prototype.getOptionalGroup = function() { + return /** @type{?proto.jspb.test.TestGroup.OptionalGroup} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestGroup.OptionalGroup, 3)); +}; + + +/** + * @param {?proto.jspb.test.TestGroup.OptionalGroup|undefined} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setOptionalGroup = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearOptionalGroup = function() { + return this.setOptionalGroup(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasOptionalGroup = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional string id = 4; + * @return {string} + */ +proto.jspb.test.TestGroup.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.setId = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearId = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasId = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * required Simple2 required_simple = 5; + * @return {!proto.jspb.test.Simple2} + */ +proto.jspb.test.TestGroup.prototype.getRequiredSimple = function() { + return /** @type{!proto.jspb.test.Simple2} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Simple2, 5, 1)); +}; + + +/** + * @param {!proto.jspb.test.Simple2} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setRequiredSimple = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearRequiredSimple = function() { + return jspb.Message.setField(this, 5, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasRequiredSimple = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional Simple2 optional_simple = 6; + * @return {?proto.jspb.test.Simple2} + */ +proto.jspb.test.TestGroup.prototype.getOptionalSimple = function() { + return /** @type{?proto.jspb.test.Simple2} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Simple2, 6)); +}; + + +/** + * @param {?proto.jspb.test.Simple2|undefined} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setOptionalSimple = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearOptionalSimple = function() { + return this.setOptionalSimple(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasOptionalSimple = function() { + return jspb.Message.getField(this, 6) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup1.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup1.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup1} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup1.toObject = function(includeInstance, msg) { + var f, obj = { +group: (f = msg.getGroup()) && proto.jspb.test.TestGroup.RepeatedGroup.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup1} + */ +proto.jspb.test.TestGroup1.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup1; + return proto.jspb.test.TestGroup1.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup1} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup1} + */ +proto.jspb.test.TestGroup1.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.jspb.test.TestGroup.RepeatedGroup; + reader.readMessage(value,proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader); + msg.setGroup(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup1.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup1.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup1} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup1.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getGroup(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter + ); + } +}; + + +/** + * optional TestGroup.RepeatedGroup group = 1; + * @return {?proto.jspb.test.TestGroup.RepeatedGroup} + */ +proto.jspb.test.TestGroup1.prototype.getGroup = function() { + return /** @type{?proto.jspb.test.TestGroup.RepeatedGroup} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestGroup.RepeatedGroup, 1)); +}; + + +/** + * @param {?proto.jspb.test.TestGroup.RepeatedGroup|undefined} value + * @return {!proto.jspb.test.TestGroup1} returns this +*/ +proto.jspb.test.TestGroup1.prototype.setGroup = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestGroup1} returns this + */ +proto.jspb.test.TestGroup1.prototype.clearGroup = function() { + return this.setGroup(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup1.prototype.hasGroup = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestReservedNames.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestReservedNames.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestReservedNames} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestReservedNames.toObject = function(includeInstance, msg) { + var f, obj = { +extension: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.TestReservedNames.extensions, proto.jspb.test.TestReservedNames.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestReservedNames} + */ +proto.jspb.test.TestReservedNames.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestReservedNames; + return proto.jspb.test.TestReservedNames.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestReservedNames} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestReservedNames} + */ +proto.jspb.test.TestReservedNames.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setExtension$(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.TestReservedNames.extensionsBinary, + proto.jspb.test.TestReservedNames.prototype.getExtension, + proto.jspb.test.TestReservedNames.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestReservedNames.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestReservedNames.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestReservedNames} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestReservedNames.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.TestReservedNames.extensionsBinary, proto.jspb.test.TestReservedNames.prototype.getExtension); +}; + + +/** + * optional int32 extension = 1; + * @return {number} + */ +proto.jspb.test.TestReservedNames.prototype.getExtension$ = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestReservedNames} returns this + */ +proto.jspb.test.TestReservedNames.prototype.setExtension$ = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestReservedNames} returns this + */ +proto.jspb.test.TestReservedNames.prototype.clearExtension$ = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestReservedNames.prototype.hasExtension$ = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestReservedNamesExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestReservedNamesExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestReservedNamesExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestReservedNamesExtension.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestReservedNamesExtension} + */ +proto.jspb.test.TestReservedNamesExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestReservedNamesExtension; + return proto.jspb.test.TestReservedNamesExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestReservedNamesExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestReservedNamesExtension} + */ +proto.jspb.test.TestReservedNamesExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestReservedNamesExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestReservedNamesExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestReservedNamesExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestReservedNamesExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `foo`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( + 10, + {foo: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.TestReservedNames.extensionsBinary[10] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.TestReservedNamesExtension.foo, + jspb.BinaryReader.prototype.readInt32, + jspb.BinaryWriter.prototype.writeInt32, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestReservedNames.extensions[10] = proto.jspb.test.TestReservedNamesExtension.foo; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `foo`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( + 10, + {foo: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.TestReservedNames.extensionsBinary[10] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.TestReservedNamesExtension.foo, + jspb.BinaryReader.prototype.readInt32, + jspb.BinaryWriter.prototype.writeInt32, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestReservedNames.extensions[10] = proto.jspb.test.TestReservedNamesExtension.foo; + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.TestMessageWithOneof.repeatedFields_ = [9]; + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.jspb.test.TestMessageWithOneof.oneofGroups_ = [[3,5],[6,7],[10,11],[12,13]]; + +/** + * @enum {number} + */ +proto.jspb.test.TestMessageWithOneof.PartialOneofCase = { + PARTIAL_ONEOF_NOT_SET: 0, + PONE: 3, + PTHREE: 5 +}; + +/** + * @return {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getPartialOneofCase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0])); +}; + +/** + * @enum {number} + */ +proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase = { + RECURSIVE_ONEOF_NOT_SET: 0, + RONE: 6, + RTWO: 7 +}; + +/** + * @return {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getRecursiveOneofCase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1])); +}; + +/** + * @enum {number} + */ +proto.jspb.test.TestMessageWithOneof.DefaultOneofACase = { + DEFAULT_ONEOF_A_NOT_SET: 0, + AONE: 10, + ATWO: 11 +}; + +/** + * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getDefaultOneofACase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2])); +}; + +/** + * @enum {number} + */ +proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase = { + DEFAULT_ONEOF_B_NOT_SET: 0, + BONE: 12, + BTWO: 13 +}; + +/** + * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getDefaultOneofBCase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestMessageWithOneof.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestMessageWithOneof.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestMessageWithOneof} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestMessageWithOneof.toObject = function(includeInstance, msg) { + var f, obj = { +pone: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, +pthree: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f, +rone: (f = msg.getRone()) && proto.jspb.test.TestMessageWithOneof.toObject(includeInstance, f), +rtwo: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f, +normalField: (f = jspb.Message.getBooleanField(msg, 8)) == null ? undefined : f, +repeatedFieldList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f, +aone: jspb.Message.getFieldWithDefault(msg, 10, 1234), +atwo: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f, +bone: (f = jspb.Message.getField(msg, 12)) == null ? undefined : f, +btwo: jspb.Message.getFieldWithDefault(msg, 13, 1234) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestMessageWithOneof} + */ +proto.jspb.test.TestMessageWithOneof.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestMessageWithOneof; + return proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestMessageWithOneof} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestMessageWithOneof} + */ +proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setPone(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setPthree(value); + break; + case 6: + var value = new proto.jspb.test.TestMessageWithOneof; + reader.readMessage(value,proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader); + msg.setRone(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setRtwo(value); + break; + case 8: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setNormalField(value); + break; + case 9: + var value = /** @type {string} */ (reader.readString()); + msg.addRepeatedField(value); + break; + case 10: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAone(value); + break; + case 11: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAtwo(value); + break; + case 12: + var value = /** @type {number} */ (reader.readInt32()); + msg.setBone(value); + break; + case 13: + var value = /** @type {number} */ (reader.readInt32()); + msg.setBtwo(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestMessageWithOneof.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestMessageWithOneof} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeString( + 5, + f + ); + } + f = message.getRone(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeString( + 7, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeBool( + 8, + f + ); + } + f = message.getRepeatedFieldList(); + if (f.length > 0) { + writer.writeRepeatedString( + 9, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeInt32( + 10, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 11)); + if (f != null) { + writer.writeInt32( + 11, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 12)); + if (f != null) { + writer.writeInt32( + 12, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 13)); + if (f != null) { + writer.writeInt32( + 13, + f + ); + } +}; + + +/** + * optional string pone = 3; + * @return {string} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getPone = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setPone = function(value) { + return jspb.Message.setOneofField(this, 3, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearPone = function() { + return jspb.Message.setOneofField(this, 3, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasPone = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional string pthree = 5; + * @return {string} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getPthree = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setPthree = function(value) { + return jspb.Message.setOneofField(this, 5, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearPthree = function() { + return jspb.Message.setOneofField(this, 5, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasPthree = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional TestMessageWithOneof rone = 6; + * @return {?proto.jspb.test.TestMessageWithOneof} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getRone = function() { + return /** @type{?proto.jspb.test.TestMessageWithOneof} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestMessageWithOneof, 6)); +}; + + +/** + * @param {?proto.jspb.test.TestMessageWithOneof|undefined} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this +*/ +proto.jspb.test.TestMessageWithOneof.prototype.setRone = function(value) { + return jspb.Message.setOneofWrapperField(this, 6, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearRone = function() { + return this.setRone(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasRone = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional string rtwo = 7; + * @return {string} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getRtwo = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setRtwo = function(value) { + return jspb.Message.setOneofField(this, 7, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearRtwo = function() { + return jspb.Message.setOneofField(this, 7, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasRtwo = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional bool normal_field = 8; + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getNormalField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setNormalField = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearNormalField = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasNormalField = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * repeated string repeated_field = 9; + * @return {!Array} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getRepeatedFieldList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 9)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setRepeatedFieldList = function(value) { + return jspb.Message.setField(this, 9, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.addRepeatedField = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 9, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearRepeatedFieldList = function() { + return this.setRepeatedFieldList([]); +}; + + +/** + * optional int32 aone = 10; + * @return {number} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getAone = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 10, 1234)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setAone = function(value) { + return jspb.Message.setOneofField(this, 10, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearAone = function() { + return jspb.Message.setOneofField(this, 10, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasAone = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * optional int32 atwo = 11; + * @return {number} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getAtwo = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setAtwo = function(value) { + return jspb.Message.setOneofField(this, 11, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearAtwo = function() { + return jspb.Message.setOneofField(this, 11, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasAtwo = function() { + return jspb.Message.getField(this, 11) != null; +}; + + +/** + * optional int32 bone = 12; + * @return {number} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getBone = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 12, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setBone = function(value) { + return jspb.Message.setOneofField(this, 12, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearBone = function() { + return jspb.Message.setOneofField(this, 12, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasBone = function() { + return jspb.Message.getField(this, 12) != null; +}; + + +/** + * optional int32 btwo = 13; + * @return {number} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getBtwo = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 1234)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setBtwo = function(value) { + return jspb.Message.setOneofField(this, 13, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearBtwo = function() { + return jspb.Message.setOneofField(this, 13, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasBtwo = function() { + return jspb.Message.getField(this, 13) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestEndsWithBytes.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestEndsWithBytes.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestEndsWithBytes} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestEndsWithBytes.toObject = function(includeInstance, msg) { + var f, obj = { +value: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestEndsWithBytes} + */ +proto.jspb.test.TestEndsWithBytes.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestEndsWithBytes; + return proto.jspb.test.TestEndsWithBytes.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestEndsWithBytes} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestEndsWithBytes} + */ +proto.jspb.test.TestEndsWithBytes.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setValue(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestEndsWithBytes.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestEndsWithBytes.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestEndsWithBytes} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestEndsWithBytes.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional int32 value = 1; + * @return {number} + */ +proto.jspb.test.TestEndsWithBytes.prototype.getValue = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ +proto.jspb.test.TestEndsWithBytes.prototype.setValue = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ +proto.jspb.test.TestEndsWithBytes.prototype.clearValue = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestEndsWithBytes.prototype.hasValue = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bytes data = 2; + * @return {!(string|Uint8Array)} + */ +proto.jspb.test.TestEndsWithBytes.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes data = 2; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.jspb.test.TestEndsWithBytes.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.jspb.test.TestEndsWithBytes.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ +proto.jspb.test.TestEndsWithBytes.prototype.setData = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ +proto.jspb.test.TestEndsWithBytes.prototype.clearData = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestEndsWithBytes.prototype.hasData = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestLastFieldBeforePivot.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestLastFieldBeforePivot} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestLastFieldBeforePivot.toObject = function(includeInstance, msg) { + var f, obj = { +lastFieldBeforePivot: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.TestLastFieldBeforePivot.extensions, proto.jspb.test.TestLastFieldBeforePivot.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestLastFieldBeforePivot} + */ +proto.jspb.test.TestLastFieldBeforePivot.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestLastFieldBeforePivot; + return proto.jspb.test.TestLastFieldBeforePivot.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestLastFieldBeforePivot} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestLastFieldBeforePivot} + */ +proto.jspb.test.TestLastFieldBeforePivot.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setLastFieldBeforePivot(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary, + proto.jspb.test.TestLastFieldBeforePivot.prototype.getExtension, + proto.jspb.test.TestLastFieldBeforePivot.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestLastFieldBeforePivot.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestLastFieldBeforePivot} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestLastFieldBeforePivot.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary, proto.jspb.test.TestLastFieldBeforePivot.prototype.getExtension); +}; + + +/** + * optional int32 last_field_before_pivot = 1; + * @return {number} + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.getLastFieldBeforePivot = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.setLastFieldBeforePivot = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.clearLastFieldBeforePivot = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.hasLastFieldBeforePivot = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Int64Types.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Int64Types.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Int64Types} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Int64Types.toObject = function(includeInstance, msg) { + var f, obj = { +int64Normal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +int64String: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, +int64Number: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Int64Types} + */ +proto.jspb.test.Int64Types.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Int64Types; + return proto.jspb.test.Int64Types.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Int64Types} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Int64Types} + */ +proto.jspb.test.Int64Types.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setInt64Normal(value); + break; + case 2: + var value = /** @type {string} */ (reader.readSint64String()); + msg.setInt64String(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setInt64Number(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Int64Types.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Int64Types.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Int64Types} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Int64Types.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt64( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeSint64String( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeUint64( + 3, + f + ); + } +}; + + +/** + * optional int64 int64_normal = 1; + * @return {number} + */ +proto.jspb.test.Int64Types.prototype.getInt64Normal = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.setInt64Normal = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.clearInt64Normal = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Int64Types.prototype.hasInt64Normal = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional sint64 int64_string = 2; + * @return {string} + */ +proto.jspb.test.Int64Types.prototype.getInt64String = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.setInt64String = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.clearInt64String = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Int64Types.prototype.hasInt64String = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional uint64 int64_number = 3; + * @return {number} + */ +proto.jspb.test.Int64Types.prototype.getInt64Number = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.setInt64Number = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.clearInt64Number = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Int64Types.prototype.hasInt64Number = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestMapFieldsNoBinary.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestMapFieldsNoBinary} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestMapFieldsNoBinary.toObject = function(includeInstance, msg) { + var f, obj = { +mapStringStringMap: (f = msg.getMapStringStringMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringInt32Map: (f = msg.getMapStringInt32Map()) ? f.toObject(includeInstance, undefined) : [], +mapStringInt64Map: (f = msg.getMapStringInt64Map()) ? f.toObject(includeInstance, undefined) : [], +mapStringBoolMap: (f = msg.getMapStringBoolMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringDoubleMap: (f = msg.getMapStringDoubleMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringEnumMap: (f = msg.getMapStringEnumMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringMsgMap: (f = msg.getMapStringMsgMap()) ? f.toObject(includeInstance, proto.jspb.test.MapValueMessageNoBinary.toObject) : [], +mapInt32StringMap: (f = msg.getMapInt32StringMap()) ? f.toObject(includeInstance, undefined) : [], +mapInt64StringMap: (f = msg.getMapInt64StringMap()) ? f.toObject(includeInstance, undefined) : [], +mapBoolStringMap: (f = msg.getMapBoolStringMap()) ? f.toObject(includeInstance, undefined) : [], +testMapFields: (f = msg.getTestMapFields()) && proto.jspb.test.TestMapFieldsNoBinary.toObject(includeInstance, f), +mapStringTestmapfieldsMap: (f = msg.getMapStringTestmapfieldsMap()) ? f.toObject(includeInstance, proto.jspb.test.TestMapFieldsNoBinary.toObject) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} + */ +proto.jspb.test.TestMapFieldsNoBinary.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestMapFieldsNoBinary; + return proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestMapFieldsNoBinary} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} + */ +proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getMapStringStringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); + }); + break; + case 2: + var value = msg.getMapStringInt32Map(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt32, null, "", 0); + }); + break; + case 3: + var value = msg.getMapStringInt64Map(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt64, null, "", 0); + }); + break; + case 4: + var value = msg.getMapStringBoolMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readBool, null, "", false); + }); + break; + case 5: + var value = msg.getMapStringDoubleMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readDouble, null, "", 0.0); + }); + break; + case 6: + var value = msg.getMapStringEnumMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readEnum, null, "", 0); + }); + break; + case 7: + var value = msg.getMapStringMsgMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader, "", new proto.jspb.test.MapValueMessageNoBinary()); + }); + break; + case 8: + var value = msg.getMapInt32StringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt32, jspb.BinaryReader.prototype.readString, null, 0, ""); + }); + break; + case 9: + var value = msg.getMapInt64StringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt64, jspb.BinaryReader.prototype.readString, null, 0, ""); + }); + break; + case 10: + var value = msg.getMapBoolStringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readBool, jspb.BinaryReader.prototype.readString, null, false, ""); + }); + break; + case 11: + var value = new proto.jspb.test.TestMapFieldsNoBinary; + reader.readMessage(value,proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader); + msg.setTestMapFields(value); + break; + case 12: + var value = msg.getMapStringTestmapfieldsMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader, "", new proto.jspb.test.TestMapFieldsNoBinary()); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestMapFieldsNoBinary} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMapStringStringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); + } + f = message.getMapStringInt32Map(true); + if (f && f.getLength() > 0) { + f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt32); + } + f = message.getMapStringInt64Map(true); + if (f && f.getLength() > 0) { + f.serializeBinary(3, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt64); + } + f = message.getMapStringBoolMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(4, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeBool); + } + f = message.getMapStringDoubleMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(5, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeDouble); + } + f = message.getMapStringEnumMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(6, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeEnum); + } + f = message.getMapStringMsgMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(7, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter); + } + f = message.getMapInt32StringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(8, writer, jspb.BinaryWriter.prototype.writeInt32, jspb.BinaryWriter.prototype.writeString); + } + f = message.getMapInt64StringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(9, writer, jspb.BinaryWriter.prototype.writeInt64, jspb.BinaryWriter.prototype.writeString); + } + f = message.getMapBoolStringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(10, writer, jspb.BinaryWriter.prototype.writeBool, jspb.BinaryWriter.prototype.writeString); + } + f = message.getTestMapFields(); + if (f != null) { + writer.writeMessage( + 11, + f, + proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter + ); + } + f = message.getMapStringTestmapfieldsMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(12, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter); + } +}; + + +/** + * map map_string_string = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringStringMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringStringMap = function() { + this.getMapStringStringMap().clear(); + return this; +}; + + +/** + * map map_string_int32 = 2; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringInt32Map = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 2, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringInt32Map = function() { + this.getMapStringInt32Map().clear(); + return this; +}; + + +/** + * map map_string_int64 = 3; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringInt64Map = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 3, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringInt64Map = function() { + this.getMapStringInt64Map().clear(); + return this; +}; + + +/** + * map map_string_bool = 4; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringBoolMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 4, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringBoolMap = function() { + this.getMapStringBoolMap().clear(); + return this; +}; + + +/** + * map map_string_double = 5; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringDoubleMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 5, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringDoubleMap = function() { + this.getMapStringDoubleMap().clear(); + return this; +}; + + +/** + * map map_string_enum = 6; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringEnumMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 6, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringEnumMap = function() { + this.getMapStringEnumMap().clear(); + return this; +}; + + +/** + * map map_string_msg = 7; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringMsgMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 7, opt_noLazyCreate, + proto.jspb.test.MapValueMessageNoBinary)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringMsgMap = function() { + this.getMapStringMsgMap().clear(); + return this; +}; + + +/** + * map map_int32_string = 8; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapInt32StringMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 8, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapInt32StringMap = function() { + this.getMapInt32StringMap().clear(); + return this; +}; + + +/** + * map map_int64_string = 9; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapInt64StringMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 9, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapInt64StringMap = function() { + this.getMapInt64StringMap().clear(); + return this; +}; + + +/** + * map map_bool_string = 10; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapBoolStringMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 10, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapBoolStringMap = function() { + this.getMapBoolStringMap().clear(); + return this; +}; + + +/** + * optional TestMapFieldsNoBinary test_map_fields = 11; + * @return {?proto.jspb.test.TestMapFieldsNoBinary} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getTestMapFields = function() { + return /** @type{?proto.jspb.test.TestMapFieldsNoBinary} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestMapFieldsNoBinary, 11)); +}; + + +/** + * @param {?proto.jspb.test.TestMapFieldsNoBinary|undefined} value + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this +*/ +proto.jspb.test.TestMapFieldsNoBinary.prototype.setTestMapFields = function(value) { + return jspb.Message.setWrapperField(this, 11, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearTestMapFields = function() { + return this.setTestMapFields(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.hasTestMapFields = function() { + return jspb.Message.getField(this, 11) != null; +}; + + +/** + * map map_string_testmapfields = 12; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringTestmapfieldsMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 12, opt_noLazyCreate, + proto.jspb.test.TestMapFieldsNoBinary)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringTestmapfieldsMap = function() { + this.getMapStringTestmapfieldsMap().clear(); + return this; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.MapValueMessageNoBinary.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.MapValueMessageNoBinary} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.MapValueMessageNoBinary.toObject = function(includeInstance, msg) { + var f, obj = { +foo: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.MapValueMessageNoBinary} + */ +proto.jspb.test.MapValueMessageNoBinary.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.MapValueMessageNoBinary; + return proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.MapValueMessageNoBinary} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.MapValueMessageNoBinary} + */ +proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setFoo(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.MapValueMessageNoBinary} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 foo = 1; + * @return {number} + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.getFoo = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.setFoo = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.clearFoo = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.hasFoo = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Deeply.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Deeply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Deeply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Deeply} + */ +proto.jspb.test.Deeply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Deeply; + return proto.jspb.test.Deeply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Deeply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Deeply} + */ +proto.jspb.test.Deeply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Deeply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Deeply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Deeply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Deeply.Nested.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Deeply.Nested.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Deeply.Nested} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.Nested.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Deeply.Nested} + */ +proto.jspb.test.Deeply.Nested.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Deeply.Nested; + return proto.jspb.test.Deeply.Nested.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Deeply.Nested} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Deeply.Nested} + */ +proto.jspb.test.Deeply.Nested.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Deeply.Nested.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Deeply.Nested.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Deeply.Nested} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.Nested.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Deeply.Nested.Message.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Deeply.Nested.Message.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Deeply.Nested.Message} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.Nested.Message.toObject = function(includeInstance, msg) { + var f, obj = { +count: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Deeply.Nested.Message} + */ +proto.jspb.test.Deeply.Nested.Message.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Deeply.Nested.Message; + return proto.jspb.test.Deeply.Nested.Message.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Deeply.Nested.Message} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Deeply.Nested.Message} + */ +proto.jspb.test.Deeply.Nested.Message.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setCount(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Deeply.Nested.Message.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Deeply.Nested.Message.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Deeply.Nested.Message} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.Nested.Message.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 count = 1; + * @return {number} + */ +proto.jspb.test.Deeply.Nested.Message.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Deeply.Nested.Message} returns this + */ +proto.jspb.test.Deeply.Nested.Message.prototype.setCount = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Deeply.Nested.Message} returns this + */ +proto.jspb.test.Deeply.Nested.Message.prototype.clearCount = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Deeply.Nested.Message.prototype.hasCount = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * @enum {number} + */ +proto.jspb.test.OuterEnum = { + FOO: 1, + BAR: 2 +}; + +/** + * @enum {number} + */ +proto.jspb.test.MapValueEnumNoBinary = { + MAP_VALUE_FOO_NOBINARY: 0, + MAP_VALUE_BAR_NOBINARY: 1, + MAP_VALUE_BAZ_NOBINARY: 2 +}; + +/** + * @enum {number} + */ +proto.jspb.test.TestAllowAliasEnum = { + TEST_ALLOW_ALIAS_DEFAULT: 0, + VALUE1: 1 +}; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `simple1`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.simple1 = new jspb.ExtensionFieldInfo( + 105, + {simple1: 0}, + proto.jspb.test.Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.Simple1.toObject), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[105] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.simple1, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.Simple1.serializeBinaryToWriter, + proto.jspb.test.Simple1.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[105] = proto.jspb.test.simple1; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extendTestLastFieldBeforePivotField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.extendTestLastFieldBeforePivotField = new jspb.ExtensionFieldInfo( + 101, + {extendTestLastFieldBeforePivotField: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.extendTestLastFieldBeforePivotField, + jspb.BinaryReader.prototype.readInt32, + jspb.BinaryWriter.prototype.writeInt32, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestLastFieldBeforePivot.extensions[101] = proto.jspb.test.extendTestLastFieldBeforePivotField; + +export const BooleanFields = proto.jspb.test.BooleanFields; +export const CloneExtension = proto.jspb.test.CloneExtension; +export const Complex = proto.jspb.test.Complex; +export const ComplexNested = proto.jspb.test.Complex.Nested; +export const Deeply = proto.jspb.test.Deeply; +export const DeeplyNested = proto.jspb.test.Deeply.Nested; +export const DeeplyNestedMessage = proto.jspb.test.Deeply.Nested.Message; +export const DefaultValues = proto.jspb.test.DefaultValues; +export const DefaultValuesEnum = proto.jspb.test.DefaultValues.Enum; +export const Empty = proto.jspb.test.Empty; +export const EnumContainer = proto.jspb.test.EnumContainer; +export const FloatingPointFields = proto.jspb.test.FloatingPointFields; +export const HasExtensions = proto.jspb.test.HasExtensions; +export const IndirectExtension = proto.jspb.test.IndirectExtension; +export const Int64Types = proto.jspb.test.Int64Types; +export const IsExtension = proto.jspb.test.IsExtension; +export const MapValueEnumNoBinary = proto.jspb.test.MapValueEnumNoBinary; +export const MapValueMessageNoBinary = proto.jspb.test.MapValueMessageNoBinary; +export const MineField = proto.jspb.test.MineField; +export const OptionalFields = proto.jspb.test.OptionalFields; +export const OptionalFieldsNested = proto.jspb.test.OptionalFields.Nested; +export const OuterEnum = proto.jspb.test.OuterEnum; +export const OuterMessage = proto.jspb.test.OuterMessage; +export const OuterMessageComplex = proto.jspb.test.OuterMessage.Complex; +export const Simple1 = proto.jspb.test.Simple1; +export const Simple2 = proto.jspb.test.Simple2; +export const SpecialCases = proto.jspb.test.SpecialCases; +export const TestAllowAliasEnum = proto.jspb.test.TestAllowAliasEnum; +export const TestClone = proto.jspb.test.TestClone; +export const TestCloneExtension = proto.jspb.test.TestCloneExtension; +export const TestEndsWithBytes = proto.jspb.test.TestEndsWithBytes; +export const TestGroup = proto.jspb.test.TestGroup; +export const TestGroupOptionalGroup = proto.jspb.test.TestGroup.OptionalGroup; +export const TestGroupRepeatedGroup = proto.jspb.test.TestGroup.RepeatedGroup; +export const TestGroupRequiredGroup = proto.jspb.test.TestGroup.RequiredGroup; +export const TestGroup1 = proto.jspb.test.TestGroup1; +export const TestLastFieldBeforePivot = proto.jspb.test.TestLastFieldBeforePivot; +export const TestMapFieldsNoBinary = proto.jspb.test.TestMapFieldsNoBinary; +export const TestMessageWithOneof = proto.jspb.test.TestMessageWithOneof; +export const TestMessageWithOneofDefaultOneofACase = proto.jspb.test.TestMessageWithOneof.DefaultOneofACase; +export const TestMessageWithOneofDefaultOneofBCase = proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase; +export const TestMessageWithOneofPartialOneofCase = proto.jspb.test.TestMessageWithOneof.PartialOneofCase; +export const TestMessageWithOneofRecursiveOneofCase = proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase; +export const TestReservedNames = proto.jspb.test.TestReservedNames; +export const TestReservedNamesExtension = proto.jspb.test.TestReservedNamesExtension; +export const extendTestLastFieldBeforePivotField = proto.jspb.test.extendTestLastFieldBeforePivotField; +export const simple1 = proto.jspb.test.simple1; From e5abd3a7f413b68f149d052fc5d5c398e0addfdf Mon Sep 17 00:00:00 2001 From: Jacob Fugal Date: Mon, 6 Jan 2025 11:33:56 -0700 Subject: [PATCH 04/12] remove unneeded `goog.object.extend` --- example/test.js | 1 - generator/js_generator.cc | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/example/test.js b/example/test.js index f73fc750..6c46f57e 100644 --- a/example/test.js +++ b/example/test.js @@ -16,7 +16,6 @@ var goog = jspb; var proto = {}; import * as google_protobuf_descriptor_pb from 'google-protobuf/google/protobuf/descriptor.js'; -goog.object.extend(proto, google_protobuf_descriptor_pb); goog.exportSymbol('proto.jspb.test.BooleanFields', null, global); goog.exportSymbol('proto.jspb.test.CloneExtension', null, global); goog.exportSymbol('proto.jspb.test.Complex', null, global); diff --git a/generator/js_generator.cc b/generator/js_generator.cc index 227529d1..fcbd3bbe 100644 --- a/generator/js_generator.cc +++ b/generator/js_generator.cc @@ -3680,10 +3680,10 @@ void Generator::GenerateFile(const GeneratorOptions& options, if (options.import_style == GeneratorOptions::kImportEs6) { for (int i = 0; i < file->dependency_count(); i++) { const std::string& name = file->dependency(i)->name(); - printer->Print("import * as $alias$ from '$file$';\n" - "goog.object.extend(proto, $alias$);\n", - "alias", ModuleAlias(name), "file", - GetRootPath(file->name(), name) + GetJSFilename(options, name)); + printer->Print( + "import * as $alias$ from '$file$';\n", "alias", ModuleAlias(name), + "file", + GetRootPath(file->name(), name) + GetJSFilename(options, name)); } } else { for (int i = 0; i < file->dependency_count(); i++) { From 1d39c5c6146db2190dea25113177a4d41fb2b5b0 Mon Sep 17 00:00:00 2001 From: Jacob Fugal Date: Wed, 15 Jan 2025 14:07:45 -0700 Subject: [PATCH 05/12] PR feedback --- example/test.d.ts | 1736 +++++++++----------- example/test.js | 2369 +++++++++++++-------------- generator/js_generator.cc | 627 ++++--- generator/js_generator.h | 10 +- generator/well_known_types_embed.cc | 288 +++- generator/well_known_types_embed.h | 1 + 6 files changed, 2579 insertions(+), 2452 deletions(-) diff --git a/example/test.d.ts b/example/test.d.ts index b5944de3..918f9e59 100644 --- a/example/test.d.ts +++ b/example/test.d.ts @@ -1,1013 +1,809 @@ -declare namespace proto.jspb.test { - export class Empty extends jspb.Message { +import * as jspb from 'google-protobuf'; + +export class Empty extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: Empty): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): Empty; + static deserializeBinaryFromReader(msg: Empty, reader: jspb.BinaryReader): Empty; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: Empty, writer: jspb.BinaryWriter): void; +} + +export class EnumContainer extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: EnumContainer): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): EnumContainer; + static deserializeBinaryFromReader(msg: EnumContainer, reader: jspb.BinaryReader): EnumContainer; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: EnumContainer, writer: jspb.BinaryWriter): void; + getOuterEnum(): OuterEnum; + setOuterEnum(value: OuterEnum): EnumContainer; + clearOuterEnum(): EnumContainer; + hasOuterEnum(): boolean; +} + +export class Simple1 extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: Simple1): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): Simple1; + static deserializeBinaryFromReader(msg: Simple1, reader: jspb.BinaryReader): Simple1; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: Simple1, writer: jspb.BinaryWriter): void; + getAString(): string; + setAString(value: string): Simple1; + clearAString(): Simple1; + hasAString(): boolean; + getARepeatedStringList(): string[]; + setARepeatedStringList(value: string[]): Simple1; + addARepeatedString(value: string, index?: number): Simple1; + clearARepeatedStringList(): Simple1; + getABoolean(): boolean; + setABoolean(value: boolean): Simple1; + clearABoolean(): Simple1; + hasABoolean(): boolean; +} + +export class Simple2 extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: Simple2): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): Simple2; + static deserializeBinaryFromReader(msg: Simple2, reader: jspb.BinaryReader): Simple2; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: Simple2, writer: jspb.BinaryWriter): void; + getAString(): string; + setAString(value: string): Simple2; + clearAString(): Simple2; + hasAString(): boolean; + getARepeatedStringList(): string[]; + setARepeatedStringList(value: string[]): Simple2; + addARepeatedString(value: string, index?: number): Simple2; + clearARepeatedStringList(): Simple2; +} + +export class SpecialCases extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: SpecialCases): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): SpecialCases; + static deserializeBinaryFromReader(msg: SpecialCases, reader: jspb.BinaryReader): SpecialCases; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: SpecialCases, writer: jspb.BinaryWriter): void; + getNormal(): string; + setNormal(value: string): SpecialCases; + clearNormal(): SpecialCases; + hasNormal(): boolean; + getDefault(): string; + setDefault(value: string): SpecialCases; + clearDefault(): SpecialCases; + hasDefault(): boolean; + getFunction(): string; + setFunction(value: string): SpecialCases; + clearFunction(): SpecialCases; + hasFunction(): boolean; + getVar(): string; + setVar(value: string): SpecialCases; + clearVar(): SpecialCases; + hasVar(): boolean; +} + +export class OptionalFields extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: OptionalFields): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): OptionalFields; + static deserializeBinaryFromReader(msg: OptionalFields, reader: jspb.BinaryReader): OptionalFields; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: OptionalFields, writer: jspb.BinaryWriter): void; + getAString(): string; + setAString(value: string): OptionalFields; + clearAString(): OptionalFields; + hasAString(): boolean; + getABool(): boolean; + setABool(value: boolean): OptionalFields; + clearABool(): OptionalFields; + hasABool(): boolean; + getANestedMessage(): OptionalFields.Nested | null; + setANestedMessage(value: OptionalFields.Nested | null | undefined): OptionalFields; + clearANestedMessage(): OptionalFields; + hasANestedMessage(): boolean; + getARepeatedMessageList(): OptionalFields.Nested[]; + setARepeatedMessageList(value: OptionalFields.Nested[]): OptionalFields; + addARepeatedMessage(value?: OptionalFields.Nested, index?: number): OptionalFields.Nested; + clearARepeatedMessageList(): OptionalFields; + getARepeatedStringList(): string[]; + setARepeatedStringList(value: string[]): OptionalFields; + addARepeatedString(value: string, index?: number): OptionalFields; + clearARepeatedStringList(): OptionalFields; +} + +export namespace OptionalFields { + class Nested extends jspb.Message { constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Empty): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Empty; - static deserializeBinaryFromReader(msg: proto.jspb.test.Empty, reader: jspb.BinaryReader): proto.jspb.test.Empty; + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: OptionalFields.Nested): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): OptionalFields.Nested; + static deserializeBinaryFromReader(msg: OptionalFields.Nested, reader: jspb.BinaryReader): OptionalFields.Nested; serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.Empty, writer: jspb.BinaryWriter): void; - } - - export class EnumContainer extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.EnumContainer): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.EnumContainer; - static deserializeBinaryFromReader(msg: proto.jspb.test.EnumContainer, reader: jspb.BinaryReader): proto.jspb.test.EnumContainer; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.EnumContainer, writer: jspb.BinaryWriter): void; - getOuterEnum(): proto.jspb.test.OuterEnum; - setOuterEnum(value: proto.jspb.test.OuterEnum): proto.jspb.test.EnumContainer; - clearOuterEnum(): proto.jspb.test.EnumContainer; - hasOuterEnum(): boolean; - } - - export class Simple1 extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Simple1): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Simple1; - static deserializeBinaryFromReader(msg: proto.jspb.test.Simple1, reader: jspb.BinaryReader): proto.jspb.test.Simple1; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.Simple1, writer: jspb.BinaryWriter): void; - getAString(): string; - setAString(value: string): proto.jspb.test.Simple1; - clearAString(): proto.jspb.test.Simple1; - hasAString(): boolean; - getARepeatedStringList(): string[]; - setARepeatedStringList(value: string[]): proto.jspb.test.Simple1; - addARepeatedString(value: string, index?: number): proto.jspb.test.Simple1; - clearARepeatedStringList(): proto.jspb.test.Simple1; - getABoolean(): boolean; - setABoolean(value: boolean): proto.jspb.test.Simple1; - clearABoolean(): proto.jspb.test.Simple1; - hasABoolean(): boolean; - } - - export class Simple2 extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Simple2): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Simple2; - static deserializeBinaryFromReader(msg: proto.jspb.test.Simple2, reader: jspb.BinaryReader): proto.jspb.test.Simple2; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.Simple2, writer: jspb.BinaryWriter): void; - getAString(): string; - setAString(value: string): proto.jspb.test.Simple2; - clearAString(): proto.jspb.test.Simple2; - hasAString(): boolean; - getARepeatedStringList(): string[]; - setARepeatedStringList(value: string[]): proto.jspb.test.Simple2; - addARepeatedString(value: string, index?: number): proto.jspb.test.Simple2; - clearARepeatedStringList(): proto.jspb.test.Simple2; - } - - export class SpecialCases extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.SpecialCases): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.SpecialCases; - static deserializeBinaryFromReader(msg: proto.jspb.test.SpecialCases, reader: jspb.BinaryReader): proto.jspb.test.SpecialCases; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.SpecialCases, writer: jspb.BinaryWriter): void; - getNormal(): string; - setNormal(value: string): proto.jspb.test.SpecialCases; - clearNormal(): proto.jspb.test.SpecialCases; - hasNormal(): boolean; - getDefault(): string; - setDefault(value: string): proto.jspb.test.SpecialCases; - clearDefault(): proto.jspb.test.SpecialCases; - hasDefault(): boolean; - getFunction(): string; - setFunction(value: string): proto.jspb.test.SpecialCases; - clearFunction(): proto.jspb.test.SpecialCases; - hasFunction(): boolean; - getVar(): string; - setVar(value: string): proto.jspb.test.SpecialCases; - clearVar(): proto.jspb.test.SpecialCases; - hasVar(): boolean; - } - - export class OptionalFields extends jspb.Message { + static serializeBinaryToWriter(message: OptionalFields.Nested, writer: jspb.BinaryWriter): void; + getAnInt(): number; + setAnInt(value: number): OptionalFields.Nested; + clearAnInt(): OptionalFields.Nested; + hasAnInt(): boolean; + } + +} + +export class HasExtensions extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: HasExtensions): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): HasExtensions; + static deserializeBinaryFromReader(msg: HasExtensions, reader: jspb.BinaryReader): HasExtensions; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: HasExtensions, writer: jspb.BinaryWriter): void; + getStr1(): string; + setStr1(value: string): HasExtensions; + clearStr1(): HasExtensions; + hasStr1(): boolean; + getStr2(): string; + setStr2(value: string): HasExtensions; + clearStr2(): HasExtensions; + hasStr2(): boolean; + getStr3(): string; + setStr3(value: string): HasExtensions; + clearStr3(): HasExtensions; + hasStr3(): boolean; +} + +export class Complex extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: Complex): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): Complex; + static deserializeBinaryFromReader(msg: Complex, reader: jspb.BinaryReader): Complex; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: Complex, writer: jspb.BinaryWriter): void; + getAString(): string; + setAString(value: string): Complex; + clearAString(): Complex; + hasAString(): boolean; + getAnOutOfOrderBool(): boolean; + setAnOutOfOrderBool(value: boolean): Complex; + clearAnOutOfOrderBool(): Complex; + hasAnOutOfOrderBool(): boolean; + getANestedMessage(): Complex.Nested | null; + setANestedMessage(value: Complex.Nested | null | undefined): Complex; + clearANestedMessage(): Complex; + hasANestedMessage(): boolean; + getARepeatedMessageList(): Complex.Nested[]; + setARepeatedMessageList(value: Complex.Nested[]): Complex; + addARepeatedMessage(value?: Complex.Nested, index?: number): Complex.Nested; + clearARepeatedMessageList(): Complex; + getARepeatedStringList(): string[]; + setARepeatedStringList(value: string[]): Complex; + addARepeatedString(value: string, index?: number): Complex; + clearARepeatedStringList(): Complex; + getAFloatingPointField(): number; + setAFloatingPointField(value: number): Complex; + clearAFloatingPointField(): Complex; + hasAFloatingPointField(): boolean; +} + +export namespace Complex { + class Nested extends jspb.Message { constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.OptionalFields): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.OptionalFields; - static deserializeBinaryFromReader(msg: proto.jspb.test.OptionalFields, reader: jspb.BinaryReader): proto.jspb.test.OptionalFields; + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: Complex.Nested): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): Complex.Nested; + static deserializeBinaryFromReader(msg: Complex.Nested, reader: jspb.BinaryReader): Complex.Nested; serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.OptionalFields, writer: jspb.BinaryWriter): void; - export class Nested extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.OptionalFields.Nested): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.OptionalFields.Nested; - static deserializeBinaryFromReader(msg: proto.jspb.test.OptionalFields.Nested, reader: jspb.BinaryReader): proto.jspb.test.OptionalFields.Nested; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.OptionalFields.Nested, writer: jspb.BinaryWriter): void; - getAnInt(): number; - setAnInt(value: number): proto.jspb.test.OptionalFields.Nested; - clearAnInt(): proto.jspb.test.OptionalFields.Nested; - hasAnInt(): boolean; - } - - getAString(): string; - setAString(value: string): proto.jspb.test.OptionalFields; - clearAString(): proto.jspb.test.OptionalFields; - hasAString(): boolean; - getABool(): boolean; - setABool(value: boolean): proto.jspb.test.OptionalFields; - clearABool(): proto.jspb.test.OptionalFields; - hasABool(): boolean; - getANestedMessage(): proto.jspb.test.OptionalFields.Nested | null; - setANestedMessage(value: proto.jspb.test.OptionalFields.Nested | null | undefined): proto.jspb.test.OptionalFields; - clearANestedMessage(): proto.jspb.test.OptionalFields; - hasANestedMessage(): boolean; - getARepeatedMessageList(): proto.jspb.test.OptionalFields.Nested[]; - setARepeatedMessageList(value: proto.jspb.test.OptionalFields.Nested[]): proto.jspb.test.OptionalFields; - addARepeatedMessage(value?: proto.jspb.test.OptionalFields.Nested, index?: number): proto.jspb.test.OptionalFields.Nested; - clearARepeatedMessageList(): proto.jspb.test.OptionalFields; - getARepeatedStringList(): string[]; - setARepeatedStringList(value: string[]): proto.jspb.test.OptionalFields; - addARepeatedString(value: string, index?: number): proto.jspb.test.OptionalFields; - clearARepeatedStringList(): proto.jspb.test.OptionalFields; + static serializeBinaryToWriter(message: Complex.Nested, writer: jspb.BinaryWriter): void; + getAnInt(): number; + setAnInt(value: number): Complex.Nested; + clearAnInt(): Complex.Nested; + hasAnInt(): boolean; } - export class HasExtensions extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.HasExtensions): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.HasExtensions; - static deserializeBinaryFromReader(msg: proto.jspb.test.HasExtensions, reader: jspb.BinaryReader): proto.jspb.test.HasExtensions; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.HasExtensions, writer: jspb.BinaryWriter): void; - getStr1(): string; - setStr1(value: string): proto.jspb.test.HasExtensions; - clearStr1(): proto.jspb.test.HasExtensions; - hasStr1(): boolean; - getStr2(): string; - setStr2(value: string): proto.jspb.test.HasExtensions; - clearStr2(): proto.jspb.test.HasExtensions; - hasStr2(): boolean; - getStr3(): string; - setStr3(value: string): proto.jspb.test.HasExtensions; - clearStr3(): proto.jspb.test.HasExtensions; - hasStr3(): boolean; - } - - export class Complex extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Complex): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Complex; - static deserializeBinaryFromReader(msg: proto.jspb.test.Complex, reader: jspb.BinaryReader): proto.jspb.test.Complex; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.Complex, writer: jspb.BinaryWriter): void; - export class Nested extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Complex.Nested): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Complex.Nested; - static deserializeBinaryFromReader(msg: proto.jspb.test.Complex.Nested, reader: jspb.BinaryReader): proto.jspb.test.Complex.Nested; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.Complex.Nested, writer: jspb.BinaryWriter): void; - getAnInt(): number; - setAnInt(value: number): proto.jspb.test.Complex.Nested; - clearAnInt(): proto.jspb.test.Complex.Nested; - hasAnInt(): boolean; - } - - getAString(): string; - setAString(value: string): proto.jspb.test.Complex; - clearAString(): proto.jspb.test.Complex; - hasAString(): boolean; - getAnOutOfOrderBool(): boolean; - setAnOutOfOrderBool(value: boolean): proto.jspb.test.Complex; - clearAnOutOfOrderBool(): proto.jspb.test.Complex; - hasAnOutOfOrderBool(): boolean; - getANestedMessage(): proto.jspb.test.Complex.Nested | null; - setANestedMessage(value: proto.jspb.test.Complex.Nested | null | undefined): proto.jspb.test.Complex; - clearANestedMessage(): proto.jspb.test.Complex; - hasANestedMessage(): boolean; - getARepeatedMessageList(): proto.jspb.test.Complex.Nested[]; - setARepeatedMessageList(value: proto.jspb.test.Complex.Nested[]): proto.jspb.test.Complex; - addARepeatedMessage(value?: proto.jspb.test.Complex.Nested, index?: number): proto.jspb.test.Complex.Nested; - clearARepeatedMessageList(): proto.jspb.test.Complex; - getARepeatedStringList(): string[]; - setARepeatedStringList(value: string[]): proto.jspb.test.Complex; - addARepeatedString(value: string, index?: number): proto.jspb.test.Complex; - clearARepeatedStringList(): proto.jspb.test.Complex; - getAFloatingPointField(): number; - setAFloatingPointField(value: number): proto.jspb.test.Complex; - clearAFloatingPointField(): proto.jspb.test.Complex; - hasAFloatingPointField(): boolean; - } - - export class OuterMessage extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.OuterMessage): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.OuterMessage; - static deserializeBinaryFromReader(msg: proto.jspb.test.OuterMessage, reader: jspb.BinaryReader): proto.jspb.test.OuterMessage; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.OuterMessage, writer: jspb.BinaryWriter): void; - export class Complex extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.OuterMessage.Complex): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.OuterMessage.Complex; - static deserializeBinaryFromReader(msg: proto.jspb.test.OuterMessage.Complex, reader: jspb.BinaryReader): proto.jspb.test.OuterMessage.Complex; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.OuterMessage.Complex, writer: jspb.BinaryWriter): void; - getInnerComplexField(): number; - setInnerComplexField(value: number): proto.jspb.test.OuterMessage.Complex; - clearInnerComplexField(): proto.jspb.test.OuterMessage.Complex; - hasInnerComplexField(): boolean; - } - - } - - export class MineField extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.MineField): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.MineField; - static deserializeBinaryFromReader(msg: proto.jspb.test.MineField, reader: jspb.BinaryReader): proto.jspb.test.MineField; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.MineField, writer: jspb.BinaryWriter): void; - getCookie(): string; - setCookie(value: string): proto.jspb.test.MineField; - clearCookie(): proto.jspb.test.MineField; - hasCookie(): boolean; - } - - export class IsExtension extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.IsExtension): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.IsExtension; - static deserializeBinaryFromReader(msg: proto.jspb.test.IsExtension, reader: jspb.BinaryReader): proto.jspb.test.IsExtension; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.IsExtension, writer: jspb.BinaryWriter): void; - getExt1(): string; - setExt1(value: string): proto.jspb.test.IsExtension; - clearExt1(): proto.jspb.test.IsExtension; - hasExt1(): boolean; - } - - export class IndirectExtension extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.IndirectExtension): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.IndirectExtension; - static deserializeBinaryFromReader(msg: proto.jspb.test.IndirectExtension, reader: jspb.BinaryReader): proto.jspb.test.IndirectExtension; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.IndirectExtension, writer: jspb.BinaryWriter): void; - } - - export class DefaultValues extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.DefaultValues): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.DefaultValues; - static deserializeBinaryFromReader(msg: proto.jspb.test.DefaultValues, reader: jspb.BinaryReader): proto.jspb.test.DefaultValues; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.DefaultValues, writer: jspb.BinaryWriter): void; - enum Enum { - E1 = 13, - E2 = 77, - } - - getStringField(): string; - setStringField(value: string): proto.jspb.test.DefaultValues; - clearStringField(): proto.jspb.test.DefaultValues; - hasStringField(): boolean; - getBoolField(): boolean; - setBoolField(value: boolean): proto.jspb.test.DefaultValues; - clearBoolField(): proto.jspb.test.DefaultValues; - hasBoolField(): boolean; - getIntField(): number; - setIntField(value: number): proto.jspb.test.DefaultValues; - clearIntField(): proto.jspb.test.DefaultValues; - hasIntField(): boolean; - getEnumField(): proto.jspb.test.DefaultValues.Enum; - setEnumField(value: proto.jspb.test.DefaultValues.Enum): proto.jspb.test.DefaultValues; - clearEnumField(): proto.jspb.test.DefaultValues; - hasEnumField(): boolean; - getEmptyField(): string; - setEmptyField(value: string): proto.jspb.test.DefaultValues; - clearEmptyField(): proto.jspb.test.DefaultValues; - hasEmptyField(): boolean; - getBytesField(): (string|Uint8Array); - getBytesField_asB64(): string; - getBytesField_asU8(): Uint8Array; - setBytesField(value: (string|Uint8Array)): proto.jspb.test.DefaultValues; - clearBytesField(): proto.jspb.test.DefaultValues; - hasBytesField(): boolean; - } - - export class FloatingPointFields extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.FloatingPointFields): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.FloatingPointFields; - static deserializeBinaryFromReader(msg: proto.jspb.test.FloatingPointFields, reader: jspb.BinaryReader): proto.jspb.test.FloatingPointFields; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.FloatingPointFields, writer: jspb.BinaryWriter): void; - getOptionalFloatField(): number; - setOptionalFloatField(value: number): proto.jspb.test.FloatingPointFields; - clearOptionalFloatField(): proto.jspb.test.FloatingPointFields; - hasOptionalFloatField(): boolean; - getRequiredFloatField(): number; - setRequiredFloatField(value: number): proto.jspb.test.FloatingPointFields; - clearRequiredFloatField(): proto.jspb.test.FloatingPointFields; - hasRequiredFloatField(): boolean; - getRepeatedFloatFieldList(): number[]; - setRepeatedFloatFieldList(value: number[]): proto.jspb.test.FloatingPointFields; - addRepeatedFloatField(value: number, index?: number): proto.jspb.test.FloatingPointFields; - clearRepeatedFloatFieldList(): proto.jspb.test.FloatingPointFields; - getDefaultFloatField(): number; - setDefaultFloatField(value: number): proto.jspb.test.FloatingPointFields; - clearDefaultFloatField(): proto.jspb.test.FloatingPointFields; - hasDefaultFloatField(): boolean; - getOptionalDoubleField(): number; - setOptionalDoubleField(value: number): proto.jspb.test.FloatingPointFields; - clearOptionalDoubleField(): proto.jspb.test.FloatingPointFields; - hasOptionalDoubleField(): boolean; - getRequiredDoubleField(): number; - setRequiredDoubleField(value: number): proto.jspb.test.FloatingPointFields; - clearRequiredDoubleField(): proto.jspb.test.FloatingPointFields; - hasRequiredDoubleField(): boolean; - getRepeatedDoubleFieldList(): number[]; - setRepeatedDoubleFieldList(value: number[]): proto.jspb.test.FloatingPointFields; - addRepeatedDoubleField(value: number, index?: number): proto.jspb.test.FloatingPointFields; - clearRepeatedDoubleFieldList(): proto.jspb.test.FloatingPointFields; - getDefaultDoubleField(): number; - setDefaultDoubleField(value: number): proto.jspb.test.FloatingPointFields; - clearDefaultDoubleField(): proto.jspb.test.FloatingPointFields; - hasDefaultDoubleField(): boolean; - } - - export class BooleanFields extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.BooleanFields): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.BooleanFields; - static deserializeBinaryFromReader(msg: proto.jspb.test.BooleanFields, reader: jspb.BinaryReader): proto.jspb.test.BooleanFields; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.BooleanFields, writer: jspb.BinaryWriter): void; - getOptionalBooleanField(): boolean; - setOptionalBooleanField(value: boolean): proto.jspb.test.BooleanFields; - clearOptionalBooleanField(): proto.jspb.test.BooleanFields; - hasOptionalBooleanField(): boolean; - getRequiredBooleanField(): boolean; - setRequiredBooleanField(value: boolean): proto.jspb.test.BooleanFields; - clearRequiredBooleanField(): proto.jspb.test.BooleanFields; - hasRequiredBooleanField(): boolean; - getRepeatedBooleanFieldList(): boolean[]; - setRepeatedBooleanFieldList(value: boolean[]): proto.jspb.test.BooleanFields; - addRepeatedBooleanField(value: boolean, index?: number): proto.jspb.test.BooleanFields; - clearRepeatedBooleanFieldList(): proto.jspb.test.BooleanFields; - getDefaultBooleanField(): boolean; - setDefaultBooleanField(value: boolean): proto.jspb.test.BooleanFields; - clearDefaultBooleanField(): proto.jspb.test.BooleanFields; - hasDefaultBooleanField(): boolean; - } - - export class TestClone extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestClone): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestClone; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestClone, reader: jspb.BinaryReader): proto.jspb.test.TestClone; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestClone, writer: jspb.BinaryWriter): void; - getStr(): string; - setStr(value: string): proto.jspb.test.TestClone; - clearStr(): proto.jspb.test.TestClone; - hasStr(): boolean; - getSimple1(): proto.jspb.test.Simple1 | null; - setSimple1(value: proto.jspb.test.Simple1 | null | undefined): proto.jspb.test.TestClone; - clearSimple1(): proto.jspb.test.TestClone; - hasSimple1(): boolean; - getSimple2List(): proto.jspb.test.Simple1[]; - setSimple2List(value: proto.jspb.test.Simple1[]): proto.jspb.test.TestClone; - addSimple2(value?: proto.jspb.test.Simple1, index?: number): proto.jspb.test.Simple1; - clearSimple2List(): proto.jspb.test.TestClone; - getBytesField(): (string|Uint8Array); - getBytesField_asB64(): string; - getBytesField_asU8(): Uint8Array; - setBytesField(value: (string|Uint8Array)): proto.jspb.test.TestClone; - clearBytesField(): proto.jspb.test.TestClone; - hasBytesField(): boolean; - getUnused(): string; - setUnused(value: string): proto.jspb.test.TestClone; - clearUnused(): proto.jspb.test.TestClone; - hasUnused(): boolean; - } +} - export class TestCloneExtension extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestCloneExtension): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestCloneExtension; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestCloneExtension, reader: jspb.BinaryReader): proto.jspb.test.TestCloneExtension; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestCloneExtension, writer: jspb.BinaryWriter): void; - getF(): number; - setF(value: number): proto.jspb.test.TestCloneExtension; - clearF(): proto.jspb.test.TestCloneExtension; - hasF(): boolean; - } +export class OuterMessage extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: OuterMessage): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): OuterMessage; + static deserializeBinaryFromReader(msg: OuterMessage, reader: jspb.BinaryReader): OuterMessage; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: OuterMessage, writer: jspb.BinaryWriter): void; +} - export class CloneExtension extends jspb.Message { +export namespace OuterMessage { + class Complex extends jspb.Message { constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.CloneExtension): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.CloneExtension; - static deserializeBinaryFromReader(msg: proto.jspb.test.CloneExtension, reader: jspb.BinaryReader): proto.jspb.test.CloneExtension; + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: OuterMessage.Complex): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): OuterMessage.Complex; + static deserializeBinaryFromReader(msg: OuterMessage.Complex, reader: jspb.BinaryReader): OuterMessage.Complex; serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.CloneExtension, writer: jspb.BinaryWriter): void; - getExt(): string; - setExt(value: string): proto.jspb.test.CloneExtension; - clearExt(): proto.jspb.test.CloneExtension; - hasExt(): boolean; - } - - export class TestGroup extends jspb.Message { + static serializeBinaryToWriter(message: OuterMessage.Complex, writer: jspb.BinaryWriter): void; + getInnerComplexField(): number; + setInnerComplexField(value: number): OuterMessage.Complex; + clearInnerComplexField(): OuterMessage.Complex; + hasInnerComplexField(): boolean; + } + +} + +export class MineField extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: MineField): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): MineField; + static deserializeBinaryFromReader(msg: MineField, reader: jspb.BinaryReader): MineField; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: MineField, writer: jspb.BinaryWriter): void; + getCookie(): string; + setCookie(value: string): MineField; + clearCookie(): MineField; + hasCookie(): boolean; +} + +export class IsExtension extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: IsExtension): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): IsExtension; + static deserializeBinaryFromReader(msg: IsExtension, reader: jspb.BinaryReader): IsExtension; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: IsExtension, writer: jspb.BinaryWriter): void; + getExt1(): string; + setExt1(value: string): IsExtension; + clearExt1(): IsExtension; + hasExt1(): boolean; +} + +export class IndirectExtension extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: IndirectExtension): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): IndirectExtension; + static deserializeBinaryFromReader(msg: IndirectExtension, reader: jspb.BinaryReader): IndirectExtension; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: IndirectExtension, writer: jspb.BinaryWriter): void; +} + +export class DefaultValues extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: DefaultValues): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): DefaultValues; + static deserializeBinaryFromReader(msg: DefaultValues, reader: jspb.BinaryReader): DefaultValues; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: DefaultValues, writer: jspb.BinaryWriter): void; + getStringField(): string; + setStringField(value: string): DefaultValues; + clearStringField(): DefaultValues; + hasStringField(): boolean; + getBoolField(): boolean; + setBoolField(value: boolean): DefaultValues; + clearBoolField(): DefaultValues; + hasBoolField(): boolean; + getIntField(): number; + setIntField(value: number): DefaultValues; + clearIntField(): DefaultValues; + hasIntField(): boolean; + getEnumField(): DefaultValues.Enum; + setEnumField(value: DefaultValues.Enum): DefaultValues; + clearEnumField(): DefaultValues; + hasEnumField(): boolean; + getEmptyField(): string; + setEmptyField(value: string): DefaultValues; + clearEmptyField(): DefaultValues; + hasEmptyField(): boolean; + getBytesField(): (string|Uint8Array); + getBytesField_asB64(): string; + getBytesField_asU8(): Uint8Array; + setBytesField(value: (string|Uint8Array)): DefaultValues; + clearBytesField(): DefaultValues; + hasBytesField(): boolean; +} + +export namespace DefaultValues { + enum Enum { + E1 = 13, + E2 = 77, + } + +} + +export class FloatingPointFields extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: FloatingPointFields): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): FloatingPointFields; + static deserializeBinaryFromReader(msg: FloatingPointFields, reader: jspb.BinaryReader): FloatingPointFields; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: FloatingPointFields, writer: jspb.BinaryWriter): void; + getOptionalFloatField(): number; + setOptionalFloatField(value: number): FloatingPointFields; + clearOptionalFloatField(): FloatingPointFields; + hasOptionalFloatField(): boolean; + getRequiredFloatField(): number; + setRequiredFloatField(value: number): FloatingPointFields; + clearRequiredFloatField(): FloatingPointFields; + hasRequiredFloatField(): boolean; + getRepeatedFloatFieldList(): number[]; + setRepeatedFloatFieldList(value: number[]): FloatingPointFields; + addRepeatedFloatField(value: number, index?: number): FloatingPointFields; + clearRepeatedFloatFieldList(): FloatingPointFields; + getDefaultFloatField(): number; + setDefaultFloatField(value: number): FloatingPointFields; + clearDefaultFloatField(): FloatingPointFields; + hasDefaultFloatField(): boolean; + getOptionalDoubleField(): number; + setOptionalDoubleField(value: number): FloatingPointFields; + clearOptionalDoubleField(): FloatingPointFields; + hasOptionalDoubleField(): boolean; + getRequiredDoubleField(): number; + setRequiredDoubleField(value: number): FloatingPointFields; + clearRequiredDoubleField(): FloatingPointFields; + hasRequiredDoubleField(): boolean; + getRepeatedDoubleFieldList(): number[]; + setRepeatedDoubleFieldList(value: number[]): FloatingPointFields; + addRepeatedDoubleField(value: number, index?: number): FloatingPointFields; + clearRepeatedDoubleFieldList(): FloatingPointFields; + getDefaultDoubleField(): number; + setDefaultDoubleField(value: number): FloatingPointFields; + clearDefaultDoubleField(): FloatingPointFields; + hasDefaultDoubleField(): boolean; +} + +export class BooleanFields extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: BooleanFields): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): BooleanFields; + static deserializeBinaryFromReader(msg: BooleanFields, reader: jspb.BinaryReader): BooleanFields; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: BooleanFields, writer: jspb.BinaryWriter): void; + getOptionalBooleanField(): boolean; + setOptionalBooleanField(value: boolean): BooleanFields; + clearOptionalBooleanField(): BooleanFields; + hasOptionalBooleanField(): boolean; + getRequiredBooleanField(): boolean; + setRequiredBooleanField(value: boolean): BooleanFields; + clearRequiredBooleanField(): BooleanFields; + hasRequiredBooleanField(): boolean; + getRepeatedBooleanFieldList(): boolean[]; + setRepeatedBooleanFieldList(value: boolean[]): BooleanFields; + addRepeatedBooleanField(value: boolean, index?: number): BooleanFields; + clearRepeatedBooleanFieldList(): BooleanFields; + getDefaultBooleanField(): boolean; + setDefaultBooleanField(value: boolean): BooleanFields; + clearDefaultBooleanField(): BooleanFields; + hasDefaultBooleanField(): boolean; +} + +export class TestClone extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestClone): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestClone; + static deserializeBinaryFromReader(msg: TestClone, reader: jspb.BinaryReader): TestClone; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: TestClone, writer: jspb.BinaryWriter): void; + getStr(): string; + setStr(value: string): TestClone; + clearStr(): TestClone; + hasStr(): boolean; + getSimple1(): Simple1 | null; + setSimple1(value: Simple1 | null | undefined): TestClone; + clearSimple1(): TestClone; + hasSimple1(): boolean; + getSimple2List(): Simple1[]; + setSimple2List(value: Simple1[]): TestClone; + addSimple2(value?: Simple1, index?: number): Simple1; + clearSimple2List(): TestClone; + getBytesField(): (string|Uint8Array); + getBytesField_asB64(): string; + getBytesField_asU8(): Uint8Array; + setBytesField(value: (string|Uint8Array)): TestClone; + clearBytesField(): TestClone; + hasBytesField(): boolean; + getUnused(): string; + setUnused(value: string): TestClone; + clearUnused(): TestClone; + hasUnused(): boolean; +} + +export class TestCloneExtension extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestCloneExtension): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestCloneExtension; + static deserializeBinaryFromReader(msg: TestCloneExtension, reader: jspb.BinaryReader): TestCloneExtension; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: TestCloneExtension, writer: jspb.BinaryWriter): void; + getF(): number; + setF(value: number): TestCloneExtension; + clearF(): TestCloneExtension; + hasF(): boolean; +} + +export class CloneExtension extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: CloneExtension): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): CloneExtension; + static deserializeBinaryFromReader(msg: CloneExtension, reader: jspb.BinaryReader): CloneExtension; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: CloneExtension, writer: jspb.BinaryWriter): void; + getExt(): string; + setExt(value: string): CloneExtension; + clearExt(): CloneExtension; + hasExt(): boolean; +} + +export class TestGroup extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestGroup): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestGroup; + static deserializeBinaryFromReader(msg: TestGroup, reader: jspb.BinaryReader): TestGroup; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: TestGroup, writer: jspb.BinaryWriter): void; + getRepeatedGroupList(): TestGroup.RepeatedGroup[]; + setRepeatedGroupList(value: TestGroup.RepeatedGroup[]): TestGroup; + addRepeatedGroup(value?: TestGroup.RepeatedGroup, index?: number): TestGroup.RepeatedGroup; + clearRepeatedGroupList(): TestGroup; + getRequiredGroup(): TestGroup.RequiredGroup; + setRequiredGroup(value: TestGroup.RequiredGroup): TestGroup; + clearRequiredGroup(): TestGroup; + hasRequiredGroup(): boolean; + getOptionalGroup(): TestGroup.OptionalGroup | null; + setOptionalGroup(value: TestGroup.OptionalGroup | null | undefined): TestGroup; + clearOptionalGroup(): TestGroup; + hasOptionalGroup(): boolean; + getId(): string; + setId(value: string): TestGroup; + clearId(): TestGroup; + hasId(): boolean; + getRequiredSimple(): Simple2; + setRequiredSimple(value: Simple2): TestGroup; + clearRequiredSimple(): TestGroup; + hasRequiredSimple(): boolean; + getOptionalSimple(): Simple2 | null; + setOptionalSimple(value: Simple2 | null | undefined): TestGroup; + clearOptionalSimple(): TestGroup; + hasOptionalSimple(): boolean; +} + +export namespace TestGroup { + class RepeatedGroup extends jspb.Message { constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestGroup): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestGroup; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestGroup, reader: jspb.BinaryReader): proto.jspb.test.TestGroup; + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestGroup.RepeatedGroup): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestGroup.RepeatedGroup; + static deserializeBinaryFromReader(msg: TestGroup.RepeatedGroup, reader: jspb.BinaryReader): TestGroup.RepeatedGroup; serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestGroup, writer: jspb.BinaryWriter): void; - export class RepeatedGroup extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestGroup.RepeatedGroup): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestGroup.RepeatedGroup; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestGroup.RepeatedGroup, reader: jspb.BinaryReader): proto.jspb.test.TestGroup.RepeatedGroup; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestGroup.RepeatedGroup, writer: jspb.BinaryWriter): void; - getId(): string; - setId(value: string): proto.jspb.test.TestGroup.RepeatedGroup; - clearId(): proto.jspb.test.TestGroup.RepeatedGroup; - hasId(): boolean; - getSomeBoolList(): boolean[]; - setSomeBoolList(value: boolean[]): proto.jspb.test.TestGroup.RepeatedGroup; - addSomeBool(value: boolean, index?: number): proto.jspb.test.TestGroup.RepeatedGroup; - clearSomeBoolList(): proto.jspb.test.TestGroup.RepeatedGroup; - } - - export class RequiredGroup extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestGroup.RequiredGroup): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestGroup.RequiredGroup; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestGroup.RequiredGroup, reader: jspb.BinaryReader): proto.jspb.test.TestGroup.RequiredGroup; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestGroup.RequiredGroup, writer: jspb.BinaryWriter): void; - getId(): string; - setId(value: string): proto.jspb.test.TestGroup.RequiredGroup; - clearId(): proto.jspb.test.TestGroup.RequiredGroup; - hasId(): boolean; - } - - export class OptionalGroup extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestGroup.OptionalGroup): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestGroup.OptionalGroup; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestGroup.OptionalGroup, reader: jspb.BinaryReader): proto.jspb.test.TestGroup.OptionalGroup; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestGroup.OptionalGroup, writer: jspb.BinaryWriter): void; - getId(): string; - setId(value: string): proto.jspb.test.TestGroup.OptionalGroup; - clearId(): proto.jspb.test.TestGroup.OptionalGroup; - hasId(): boolean; - } - - getRepeatedGroupList(): proto.jspb.test.TestGroup.RepeatedGroup[]; - setRepeatedGroupList(value: proto.jspb.test.TestGroup.RepeatedGroup[]): proto.jspb.test.TestGroup; - addRepeatedGroup(value?: proto.jspb.test.TestGroup.RepeatedGroup, index?: number): proto.jspb.test.TestGroup.RepeatedGroup; - clearRepeatedGroupList(): proto.jspb.test.TestGroup; - getRequiredGroup(): proto.jspb.test.TestGroup.RequiredGroup; - setRequiredGroup(value: proto.jspb.test.TestGroup.RequiredGroup): proto.jspb.test.TestGroup; - clearRequiredGroup(): proto.jspb.test.TestGroup; - hasRequiredGroup(): boolean; - getOptionalGroup(): proto.jspb.test.TestGroup.OptionalGroup | null; - setOptionalGroup(value: proto.jspb.test.TestGroup.OptionalGroup | null | undefined): proto.jspb.test.TestGroup; - clearOptionalGroup(): proto.jspb.test.TestGroup; - hasOptionalGroup(): boolean; + static serializeBinaryToWriter(message: TestGroup.RepeatedGroup, writer: jspb.BinaryWriter): void; getId(): string; - setId(value: string): proto.jspb.test.TestGroup; - clearId(): proto.jspb.test.TestGroup; + setId(value: string): TestGroup.RepeatedGroup; + clearId(): TestGroup.RepeatedGroup; hasId(): boolean; - getRequiredSimple(): proto.jspb.test.Simple2; - setRequiredSimple(value: proto.jspb.test.Simple2): proto.jspb.test.TestGroup; - clearRequiredSimple(): proto.jspb.test.TestGroup; - hasRequiredSimple(): boolean; - getOptionalSimple(): proto.jspb.test.Simple2 | null; - setOptionalSimple(value: proto.jspb.test.Simple2 | null | undefined): proto.jspb.test.TestGroup; - clearOptionalSimple(): proto.jspb.test.TestGroup; - hasOptionalSimple(): boolean; + getSomeBoolList(): boolean[]; + setSomeBoolList(value: boolean[]): TestGroup.RepeatedGroup; + addSomeBool(value: boolean, index?: number): TestGroup.RepeatedGroup; + clearSomeBoolList(): TestGroup.RepeatedGroup; } - export class TestGroup1 extends jspb.Message { + class RequiredGroup extends jspb.Message { constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestGroup1): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestGroup1; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestGroup1, reader: jspb.BinaryReader): proto.jspb.test.TestGroup1; + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestGroup.RequiredGroup): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestGroup.RequiredGroup; + static deserializeBinaryFromReader(msg: TestGroup.RequiredGroup, reader: jspb.BinaryReader): TestGroup.RequiredGroup; serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestGroup1, writer: jspb.BinaryWriter): void; - getGroup(): proto.jspb.test.TestGroup.RepeatedGroup | null; - setGroup(value: proto.jspb.test.TestGroup.RepeatedGroup | null | undefined): proto.jspb.test.TestGroup1; - clearGroup(): proto.jspb.test.TestGroup1; - hasGroup(): boolean; - } - - export class TestReservedNames extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestReservedNames): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestReservedNames; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestReservedNames, reader: jspb.BinaryReader): proto.jspb.test.TestReservedNames; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestReservedNames, writer: jspb.BinaryWriter): void; - getExtension$(): number; - setExtension$(value: number): proto.jspb.test.TestReservedNames; - clearExtension$(): proto.jspb.test.TestReservedNames; - hasExtension$(): boolean; - } - - export class TestReservedNamesExtension extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestReservedNamesExtension): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestReservedNamesExtension; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestReservedNamesExtension, reader: jspb.BinaryReader): proto.jspb.test.TestReservedNamesExtension; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestReservedNamesExtension, writer: jspb.BinaryWriter): void; - } - - export class TestMessageWithOneof extends jspb.Message { - constructor(data?: any[] | null); - enum PartialOneofCase = { - PARTIAL_ONEOF_NOT_SET: 0, - PONE: 3, - PTHREE: 5, - }; - getPartialOneofCase(): proto.jspb.test.TestMessageWithOneof.PartialOneofCase; - enum RecursiveOneofCase = { - RECURSIVE_ONEOF_NOT_SET: 0, - RONE: 6, - RTWO: 7, - }; - getRecursiveOneofCase(): proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase; - enum DefaultOneofACase = { - DEFAULT_ONEOF_A_NOT_SET: 0, - AONE: 10, - ATWO: 11, - }; - getDefaultOneofACase(): proto.jspb.test.TestMessageWithOneof.DefaultOneofACase; - enum DefaultOneofBCase = { - DEFAULT_ONEOF_B_NOT_SET: 0, - BONE: 12, - BTWO: 13, - }; - getDefaultOneofBCase(): proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase; - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestMessageWithOneof): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestMessageWithOneof; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestMessageWithOneof, reader: jspb.BinaryReader): proto.jspb.test.TestMessageWithOneof; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestMessageWithOneof, writer: jspb.BinaryWriter): void; - getPone(): string; - setPone(value: string): proto.jspb.test.TestMessageWithOneof; - clearPone(): proto.jspb.test.TestMessageWithOneof; - hasPone(): boolean; - getPthree(): string; - setPthree(value: string): proto.jspb.test.TestMessageWithOneof; - clearPthree(): proto.jspb.test.TestMessageWithOneof; - hasPthree(): boolean; - getRone(): proto.jspb.test.TestMessageWithOneof | null; - setRone(value: proto.jspb.test.TestMessageWithOneof | null | undefined): proto.jspb.test.TestMessageWithOneof; - clearRone(): proto.jspb.test.TestMessageWithOneof; - hasRone(): boolean; - getRtwo(): string; - setRtwo(value: string): proto.jspb.test.TestMessageWithOneof; - clearRtwo(): proto.jspb.test.TestMessageWithOneof; - hasRtwo(): boolean; - getNormalField(): boolean; - setNormalField(value: boolean): proto.jspb.test.TestMessageWithOneof; - clearNormalField(): proto.jspb.test.TestMessageWithOneof; - hasNormalField(): boolean; - getRepeatedFieldList(): string[]; - setRepeatedFieldList(value: string[]): proto.jspb.test.TestMessageWithOneof; - addRepeatedField(value: string, index?: number): proto.jspb.test.TestMessageWithOneof; - clearRepeatedFieldList(): proto.jspb.test.TestMessageWithOneof; - getAone(): number; - setAone(value: number): proto.jspb.test.TestMessageWithOneof; - clearAone(): proto.jspb.test.TestMessageWithOneof; - hasAone(): boolean; - getAtwo(): number; - setAtwo(value: number): proto.jspb.test.TestMessageWithOneof; - clearAtwo(): proto.jspb.test.TestMessageWithOneof; - hasAtwo(): boolean; - getBone(): number; - setBone(value: number): proto.jspb.test.TestMessageWithOneof; - clearBone(): proto.jspb.test.TestMessageWithOneof; - hasBone(): boolean; - getBtwo(): number; - setBtwo(value: number): proto.jspb.test.TestMessageWithOneof; - clearBtwo(): proto.jspb.test.TestMessageWithOneof; - hasBtwo(): boolean; - } - - export class TestEndsWithBytes extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestEndsWithBytes): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestEndsWithBytes; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestEndsWithBytes, reader: jspb.BinaryReader): proto.jspb.test.TestEndsWithBytes; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestEndsWithBytes, writer: jspb.BinaryWriter): void; - getValue(): number; - setValue(value: number): proto.jspb.test.TestEndsWithBytes; - clearValue(): proto.jspb.test.TestEndsWithBytes; - hasValue(): boolean; - getData(): (string|Uint8Array); - getData_asB64(): string; - getData_asU8(): Uint8Array; - setData(value: (string|Uint8Array)): proto.jspb.test.TestEndsWithBytes; - clearData(): proto.jspb.test.TestEndsWithBytes; - hasData(): boolean; - } - - export class TestLastFieldBeforePivot extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestLastFieldBeforePivot): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestLastFieldBeforePivot; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestLastFieldBeforePivot, reader: jspb.BinaryReader): proto.jspb.test.TestLastFieldBeforePivot; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestLastFieldBeforePivot, writer: jspb.BinaryWriter): void; - getLastFieldBeforePivot(): number; - setLastFieldBeforePivot(value: number): proto.jspb.test.TestLastFieldBeforePivot; - clearLastFieldBeforePivot(): proto.jspb.test.TestLastFieldBeforePivot; - hasLastFieldBeforePivot(): boolean; + static serializeBinaryToWriter(message: TestGroup.RequiredGroup, writer: jspb.BinaryWriter): void; + getId(): string; + setId(value: string): TestGroup.RequiredGroup; + clearId(): TestGroup.RequiredGroup; + hasId(): boolean; } - export class Int64Types extends jspb.Message { + class OptionalGroup extends jspb.Message { constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Int64Types): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Int64Types; - static deserializeBinaryFromReader(msg: proto.jspb.test.Int64Types, reader: jspb.BinaryReader): proto.jspb.test.Int64Types; + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestGroup.OptionalGroup): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestGroup.OptionalGroup; + static deserializeBinaryFromReader(msg: TestGroup.OptionalGroup, reader: jspb.BinaryReader): TestGroup.OptionalGroup; serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.Int64Types, writer: jspb.BinaryWriter): void; - getInt64Normal(): number; - setInt64Normal(value: number): proto.jspb.test.Int64Types; - clearInt64Normal(): proto.jspb.test.Int64Types; - hasInt64Normal(): boolean; - getInt64String(): string; - setInt64String(value: string): proto.jspb.test.Int64Types; - clearInt64String(): proto.jspb.test.Int64Types; - hasInt64String(): boolean; - getInt64Number(): number; - setInt64Number(value: number): proto.jspb.test.Int64Types; - clearInt64Number(): proto.jspb.test.Int64Types; - hasInt64Number(): boolean; + static serializeBinaryToWriter(message: TestGroup.OptionalGroup, writer: jspb.BinaryWriter): void; + getId(): string; + setId(value: string): TestGroup.OptionalGroup; + clearId(): TestGroup.OptionalGroup; + hasId(): boolean; } - export class TestMapFieldsNoBinary extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.TestMapFieldsNoBinary): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.TestMapFieldsNoBinary; - static deserializeBinaryFromReader(msg: proto.jspb.test.TestMapFieldsNoBinary, reader: jspb.BinaryReader): proto.jspb.test.TestMapFieldsNoBinary; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.TestMapFieldsNoBinary, writer: jspb.BinaryWriter): void; - getMapStringStringMap(noLazyCreate?: boolean): jspb.Map | undefined; - clearMapStringStringMap(): proto.jspb.test.TestMapFieldsNoBinary; - getMapStringInt32Map(noLazyCreate?: boolean): jspb.Map | undefined; - clearMapStringInt32Map(): proto.jspb.test.TestMapFieldsNoBinary; - getMapStringInt64Map(noLazyCreate?: boolean): jspb.Map | undefined; - clearMapStringInt64Map(): proto.jspb.test.TestMapFieldsNoBinary; - getMapStringBoolMap(noLazyCreate?: boolean): jspb.Map | undefined; - clearMapStringBoolMap(): proto.jspb.test.TestMapFieldsNoBinary; - getMapStringDoubleMap(noLazyCreate?: boolean): jspb.Map | undefined; - clearMapStringDoubleMap(): proto.jspb.test.TestMapFieldsNoBinary; - getMapStringEnumMap(noLazyCreate?: boolean): jspb.Map | undefined; - clearMapStringEnumMap(): proto.jspb.test.TestMapFieldsNoBinary; - getMapStringMsgMap(noLazyCreate?: boolean): jspb.Map | undefined; - clearMapStringMsgMap(): proto.jspb.test.TestMapFieldsNoBinary; - getMapInt32StringMap(noLazyCreate?: boolean): jspb.Map | undefined; - clearMapInt32StringMap(): proto.jspb.test.TestMapFieldsNoBinary; - getMapInt64StringMap(noLazyCreate?: boolean): jspb.Map | undefined; - clearMapInt64StringMap(): proto.jspb.test.TestMapFieldsNoBinary; - getMapBoolStringMap(noLazyCreate?: boolean): jspb.Map | undefined; - clearMapBoolStringMap(): proto.jspb.test.TestMapFieldsNoBinary; - getTestMapFields(): proto.jspb.test.TestMapFieldsNoBinary | null; - setTestMapFields(value: proto.jspb.test.TestMapFieldsNoBinary | null | undefined): proto.jspb.test.TestMapFieldsNoBinary; - clearTestMapFields(): proto.jspb.test.TestMapFieldsNoBinary; - hasTestMapFields(): boolean; - getMapStringTestmapfieldsMap(noLazyCreate?: boolean): jspb.Map | undefined; - clearMapStringTestmapfieldsMap(): proto.jspb.test.TestMapFieldsNoBinary; - } +} - export class MapValueMessageNoBinary extends jspb.Message { +export class TestGroup1 extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestGroup1): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestGroup1; + static deserializeBinaryFromReader(msg: TestGroup1, reader: jspb.BinaryReader): TestGroup1; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: TestGroup1, writer: jspb.BinaryWriter): void; + getGroup(): TestGroup.RepeatedGroup | null; + setGroup(value: TestGroup.RepeatedGroup | null | undefined): TestGroup1; + clearGroup(): TestGroup1; + hasGroup(): boolean; +} + +export class TestReservedNames extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestReservedNames): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestReservedNames; + static deserializeBinaryFromReader(msg: TestReservedNames, reader: jspb.BinaryReader): TestReservedNames; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: TestReservedNames, writer: jspb.BinaryWriter): void; + getExtension$(): number; + setExtension$(value: number): TestReservedNames; + clearExtension$(): TestReservedNames; + hasExtension$(): boolean; +} + +export class TestReservedNamesExtension extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestReservedNamesExtension): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestReservedNamesExtension; + static deserializeBinaryFromReader(msg: TestReservedNamesExtension, reader: jspb.BinaryReader): TestReservedNamesExtension; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: TestReservedNamesExtension, writer: jspb.BinaryWriter): void; +} + +export class TestMessageWithOneof extends jspb.Message { + constructor(data?: any[] | null); + getPartialOneofCase(): TestMessageWithOneof.PartialOneofCase; + getRecursiveOneofCase(): TestMessageWithOneof.RecursiveOneofCase; + getDefaultOneofACase(): TestMessageWithOneof.DefaultOneofACase; + getDefaultOneofBCase(): TestMessageWithOneof.DefaultOneofBCase; + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestMessageWithOneof): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestMessageWithOneof; + static deserializeBinaryFromReader(msg: TestMessageWithOneof, reader: jspb.BinaryReader): TestMessageWithOneof; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: TestMessageWithOneof, writer: jspb.BinaryWriter): void; + getPone(): string; + setPone(value: string): TestMessageWithOneof; + clearPone(): TestMessageWithOneof; + hasPone(): boolean; + getPthree(): string; + setPthree(value: string): TestMessageWithOneof; + clearPthree(): TestMessageWithOneof; + hasPthree(): boolean; + getRone(): TestMessageWithOneof | null; + setRone(value: TestMessageWithOneof | null | undefined): TestMessageWithOneof; + clearRone(): TestMessageWithOneof; + hasRone(): boolean; + getRtwo(): string; + setRtwo(value: string): TestMessageWithOneof; + clearRtwo(): TestMessageWithOneof; + hasRtwo(): boolean; + getNormalField(): boolean; + setNormalField(value: boolean): TestMessageWithOneof; + clearNormalField(): TestMessageWithOneof; + hasNormalField(): boolean; + getRepeatedFieldList(): string[]; + setRepeatedFieldList(value: string[]): TestMessageWithOneof; + addRepeatedField(value: string, index?: number): TestMessageWithOneof; + clearRepeatedFieldList(): TestMessageWithOneof; + getAone(): number; + setAone(value: number): TestMessageWithOneof; + clearAone(): TestMessageWithOneof; + hasAone(): boolean; + getAtwo(): number; + setAtwo(value: number): TestMessageWithOneof; + clearAtwo(): TestMessageWithOneof; + hasAtwo(): boolean; + getBone(): number; + setBone(value: number): TestMessageWithOneof; + clearBone(): TestMessageWithOneof; + hasBone(): boolean; + getBtwo(): number; + setBtwo(value: number): TestMessageWithOneof; + clearBtwo(): TestMessageWithOneof; + hasBtwo(): boolean; +} + +export namespace TestMessageWithOneof { + enum PartialOneofCase { + PARTIAL_ONEOF_NOT_SET = 0, + PONE = 3, + PTHREE = 5, + } + enum RecursiveOneofCase { + RECURSIVE_ONEOF_NOT_SET = 0, + RONE = 6, + RTWO = 7, + } + enum DefaultOneofACase { + DEFAULT_ONEOF_A_NOT_SET = 0, + AONE = 10, + ATWO = 11, + } + enum DefaultOneofBCase { + DEFAULT_ONEOF_B_NOT_SET = 0, + BONE = 12, + BTWO = 13, + } +} + +export class TestEndsWithBytes extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestEndsWithBytes): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestEndsWithBytes; + static deserializeBinaryFromReader(msg: TestEndsWithBytes, reader: jspb.BinaryReader): TestEndsWithBytes; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: TestEndsWithBytes, writer: jspb.BinaryWriter): void; + getValue(): number; + setValue(value: number): TestEndsWithBytes; + clearValue(): TestEndsWithBytes; + hasValue(): boolean; + getData(): (string|Uint8Array); + getData_asB64(): string; + getData_asU8(): Uint8Array; + setData(value: (string|Uint8Array)): TestEndsWithBytes; + clearData(): TestEndsWithBytes; + hasData(): boolean; +} + +export class TestLastFieldBeforePivot extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestLastFieldBeforePivot): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestLastFieldBeforePivot; + static deserializeBinaryFromReader(msg: TestLastFieldBeforePivot, reader: jspb.BinaryReader): TestLastFieldBeforePivot; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: TestLastFieldBeforePivot, writer: jspb.BinaryWriter): void; + getLastFieldBeforePivot(): number; + setLastFieldBeforePivot(value: number): TestLastFieldBeforePivot; + clearLastFieldBeforePivot(): TestLastFieldBeforePivot; + hasLastFieldBeforePivot(): boolean; +} + +export class Int64Types extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: Int64Types): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): Int64Types; + static deserializeBinaryFromReader(msg: Int64Types, reader: jspb.BinaryReader): Int64Types; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: Int64Types, writer: jspb.BinaryWriter): void; + getInt64Normal(): number; + setInt64Normal(value: number): Int64Types; + clearInt64Normal(): Int64Types; + hasInt64Normal(): boolean; + getInt64String(): string; + setInt64String(value: string): Int64Types; + clearInt64String(): Int64Types; + hasInt64String(): boolean; + getInt64Number(): number; + setInt64Number(value: number): Int64Types; + clearInt64Number(): Int64Types; + hasInt64Number(): boolean; +} + +export class TestMapFieldsNoBinary extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestMapFieldsNoBinary): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestMapFieldsNoBinary; + static deserializeBinaryFromReader(msg: TestMapFieldsNoBinary, reader: jspb.BinaryReader): TestMapFieldsNoBinary; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: TestMapFieldsNoBinary, writer: jspb.BinaryWriter): void; + getMapStringStringMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringStringMap(): TestMapFieldsNoBinary; + getMapStringInt32Map(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringInt32Map(): TestMapFieldsNoBinary; + getMapStringInt64Map(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringInt64Map(): TestMapFieldsNoBinary; + getMapStringBoolMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringBoolMap(): TestMapFieldsNoBinary; + getMapStringDoubleMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringDoubleMap(): TestMapFieldsNoBinary; + getMapStringEnumMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringEnumMap(): TestMapFieldsNoBinary; + getMapStringMsgMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringMsgMap(): TestMapFieldsNoBinary; + getMapInt32StringMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapInt32StringMap(): TestMapFieldsNoBinary; + getMapInt64StringMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapInt64StringMap(): TestMapFieldsNoBinary; + getMapBoolStringMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapBoolStringMap(): TestMapFieldsNoBinary; + getTestMapFields(): TestMapFieldsNoBinary | null; + setTestMapFields(value: TestMapFieldsNoBinary | null | undefined): TestMapFieldsNoBinary; + clearTestMapFields(): TestMapFieldsNoBinary; + hasTestMapFields(): boolean; + getMapStringTestmapfieldsMap(noLazyCreate?: boolean): jspb.Map | undefined; + clearMapStringTestmapfieldsMap(): TestMapFieldsNoBinary; +} + +export class MapValueMessageNoBinary extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: MapValueMessageNoBinary): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): MapValueMessageNoBinary; + static deserializeBinaryFromReader(msg: MapValueMessageNoBinary, reader: jspb.BinaryReader): MapValueMessageNoBinary; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: MapValueMessageNoBinary, writer: jspb.BinaryWriter): void; + getFoo(): number; + setFoo(value: number): MapValueMessageNoBinary; + clearFoo(): MapValueMessageNoBinary; + hasFoo(): boolean; +} + +export class Deeply extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: Deeply): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): Deeply; + static deserializeBinaryFromReader(msg: Deeply, reader: jspb.BinaryReader): Deeply; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: Deeply, writer: jspb.BinaryWriter): void; +} + +export namespace Deeply { + class Nested extends jspb.Message { constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.MapValueMessageNoBinary): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.MapValueMessageNoBinary; - static deserializeBinaryFromReader(msg: proto.jspb.test.MapValueMessageNoBinary, reader: jspb.BinaryReader): proto.jspb.test.MapValueMessageNoBinary; + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: Deeply.Nested): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): Deeply.Nested; + static deserializeBinaryFromReader(msg: Deeply.Nested, reader: jspb.BinaryReader): Deeply.Nested; serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.MapValueMessageNoBinary, writer: jspb.BinaryWriter): void; - getFoo(): number; - setFoo(value: number): proto.jspb.test.MapValueMessageNoBinary; - clearFoo(): proto.jspb.test.MapValueMessageNoBinary; - hasFoo(): boolean; + static serializeBinaryToWriter(message: Deeply.Nested, writer: jspb.BinaryWriter): void; } - export class Deeply extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Deeply): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Deeply; - static deserializeBinaryFromReader(msg: proto.jspb.test.Deeply, reader: jspb.BinaryReader): proto.jspb.test.Deeply; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.Deeply, writer: jspb.BinaryWriter): void; - export class Nested extends jspb.Message { + namespace Nested { + class Message extends jspb.Message { constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Deeply.Nested): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Deeply.Nested; - static deserializeBinaryFromReader(msg: proto.jspb.test.Deeply.Nested, reader: jspb.BinaryReader): proto.jspb.test.Deeply.Nested; + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: Deeply.Nested.Message): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): Deeply.Nested.Message; + static deserializeBinaryFromReader(msg: Deeply.Nested.Message, reader: jspb.BinaryReader): Deeply.Nested.Message; serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.Deeply.Nested, writer: jspb.BinaryWriter): void; - export class Message extends jspb.Message { - constructor(data?: any[] | null); - toObject(includeInstance?: boolean): GlobalObject; - static toObject(includeInstance: boolean | undefined, msg: proto.jspb.test.Deeply.Nested.Message): GlobalObject; - static deserializeBinary(bytes: jspb.ByteSource): proto.jspb.test.Deeply.Nested.Message; - static deserializeBinaryFromReader(msg: proto.jspb.test.Deeply.Nested.Message, reader: jspb.BinaryReader): proto.jspb.test.Deeply.Nested.Message; - serializeBinary(): Uint8Array; - static serializeBinaryToWriter(message: proto.jspb.test.Deeply.Nested.Message, writer: jspb.BinaryWriter): void; - getCount(): number; - setCount(value: number): proto.jspb.test.Deeply.Nested.Message; - clearCount(): proto.jspb.test.Deeply.Nested.Message; - hasCount(): boolean; - } - + static serializeBinaryToWriter(message: Deeply.Nested.Message, writer: jspb.BinaryWriter): void; + getCount(): number; + setCount(value: number): Deeply.Nested.Message; + clearCount(): Deeply.Nested.Message; + hasCount(): boolean; } } - enum OuterEnum { - FOO = 1, - BAR = 2, - } - - enum MapValueEnumNoBinary { - MAP_VALUE_FOO_NOBINARY = 0, - MAP_VALUE_BAR_NOBINARY = 1, - MAP_VALUE_BAZ_NOBINARY = 2, - } - - enum TestAllowAliasEnum { - TEST_ALLOW_ALIAS_DEFAULT = 0, - VALUE1 = 1, - } - -} - -declare module "goog:proto.jspb.test.BooleanFields " { - import BooleanFields = proto.jspb.test.BooleanFields; - export default BooleanFields; -} - -declare module "goog:proto.jspb.test.CloneExtension " { - import CloneExtension = proto.jspb.test.CloneExtension; - export default CloneExtension; -} - -declare module "goog:proto.jspb.test.Complex " { - import Complex = proto.jspb.test.Complex; - export default Complex; -} - -declare module "goog:proto.jspb.test.Deeply " { - import Deeply = proto.jspb.test.Deeply; - export default Deeply; -} - -declare module "goog:proto.jspb.test.DefaultValues " { - import DefaultValues = proto.jspb.test.DefaultValues; - export default DefaultValues; -} - -declare module "goog:proto.jspb.test.Empty " { - import Empty = proto.jspb.test.Empty; - export default Empty; -} - -declare module "goog:proto.jspb.test.EnumContainer " { - import EnumContainer = proto.jspb.test.EnumContainer; - export default EnumContainer; -} - -declare module "goog:proto.jspb.test.FloatingPointFields " { - import FloatingPointFields = proto.jspb.test.FloatingPointFields; - export default FloatingPointFields; -} - -declare module "goog:proto.jspb.test.HasExtensions " { - import HasExtensions = proto.jspb.test.HasExtensions; - export default HasExtensions; -} - -declare module "goog:proto.jspb.test.IndirectExtension " { - import IndirectExtension = proto.jspb.test.IndirectExtension; - export default IndirectExtension; -} - -declare module "goog:proto.jspb.test.Int64Types " { - import Int64Types = proto.jspb.test.Int64Types; - export default Int64Types; -} - -declare module "goog:proto.jspb.test.IsExtension " { - import IsExtension = proto.jspb.test.IsExtension; - export default IsExtension; -} - -declare module "goog:proto.jspb.test.MapValueEnumNoBinary " { - import MapValueEnumNoBinary = proto.jspb.test.MapValueEnumNoBinary; - export default MapValueEnumNoBinary; -} - -declare module "goog:proto.jspb.test.MapValueMessageNoBinary " { - import MapValueMessageNoBinary = proto.jspb.test.MapValueMessageNoBinary; - export default MapValueMessageNoBinary; -} - -declare module "goog:proto.jspb.test.MineField " { - import MineField = proto.jspb.test.MineField; - export default MineField; -} - -declare module "goog:proto.jspb.test.OptionalFields " { - import OptionalFields = proto.jspb.test.OptionalFields; - export default OptionalFields; -} - -declare module "goog:proto.jspb.test.OuterEnum " { - import OuterEnum = proto.jspb.test.OuterEnum; - export default OuterEnum; -} - -declare module "goog:proto.jspb.test.OuterMessage " { - import OuterMessage = proto.jspb.test.OuterMessage; - export default OuterMessage; -} - -declare module "goog:proto.jspb.test.Simple1 " { - import Simple1 = proto.jspb.test.Simple1; - export default Simple1; -} - -declare module "goog:proto.jspb.test.Simple2 " { - import Simple2 = proto.jspb.test.Simple2; - export default Simple2; -} - -declare module "goog:proto.jspb.test.SpecialCases " { - import SpecialCases = proto.jspb.test.SpecialCases; - export default SpecialCases; -} - -declare module "goog:proto.jspb.test.TestAllowAliasEnum " { - import TestAllowAliasEnum = proto.jspb.test.TestAllowAliasEnum; - export default TestAllowAliasEnum; -} - -declare module "goog:proto.jspb.test.TestClone " { - import TestClone = proto.jspb.test.TestClone; - export default TestClone; -} - -declare module "goog:proto.jspb.test.TestCloneExtension " { - import TestCloneExtension = proto.jspb.test.TestCloneExtension; - export default TestCloneExtension; -} - -declare module "goog:proto.jspb.test.TestEndsWithBytes " { - import TestEndsWithBytes = proto.jspb.test.TestEndsWithBytes; - export default TestEndsWithBytes; -} - -declare module "goog:proto.jspb.test.TestGroup " { - import TestGroup = proto.jspb.test.TestGroup; - export default TestGroup; -} - -declare module "goog:proto.jspb.test.TestGroup1 " { - import TestGroup1 = proto.jspb.test.TestGroup1; - export default TestGroup1; -} - -declare module "goog:proto.jspb.test.TestLastFieldBeforePivot " { - import TestLastFieldBeforePivot = proto.jspb.test.TestLastFieldBeforePivot; - export default TestLastFieldBeforePivot; -} - -declare module "goog:proto.jspb.test.TestMapFieldsNoBinary " { - import TestMapFieldsNoBinary = proto.jspb.test.TestMapFieldsNoBinary; - export default TestMapFieldsNoBinary; } -declare module "goog:proto.jspb.test.TestMessageWithOneof " { - import TestMessageWithOneof = proto.jspb.test.TestMessageWithOneof; - export default TestMessageWithOneof; +export enum OuterEnum { + FOO = 1, + BAR = 2, } -declare module "goog:proto.jspb.test.TestReservedNames " { - import TestReservedNames = proto.jspb.test.TestReservedNames; - export default TestReservedNames; +export enum MapValueEnumNoBinary { + MAP_VALUE_FOO_NOBINARY = 0, + MAP_VALUE_BAR_NOBINARY = 1, + MAP_VALUE_BAZ_NOBINARY = 2, } -declare module "goog:proto.jspb.test.TestReservedNamesExtension " { - import TestReservedNamesExtension = proto.jspb.test.TestReservedNamesExtension; - export default TestReservedNamesExtension; +export enum TestAllowAliasEnum { + TEST_ALLOW_ALIAS_DEFAULT = 0, + VALUE1 = 1, } -import BooleanFields = proto.jspb.test.BooleanFields; -import CloneExtension = proto.jspb.test.CloneExtension; -import Complex = proto.jspb.test.Complex; -import Deeply = proto.jspb.test.Deeply; -import DefaultValues = proto.jspb.test.DefaultValues; -import Empty = proto.jspb.test.Empty; -import EnumContainer = proto.jspb.test.EnumContainer; -import FloatingPointFields = proto.jspb.test.FloatingPointFields; -import HasExtensions = proto.jspb.test.HasExtensions; -import IndirectExtension = proto.jspb.test.IndirectExtension; -import Int64Types = proto.jspb.test.Int64Types; -import IsExtension = proto.jspb.test.IsExtension; -import MapValueEnumNoBinary = proto.jspb.test.MapValueEnumNoBinary; -import MapValueMessageNoBinary = proto.jspb.test.MapValueMessageNoBinary; -import MineField = proto.jspb.test.MineField; -import OptionalFields = proto.jspb.test.OptionalFields; -import OuterEnum = proto.jspb.test.OuterEnum; -import OuterMessage = proto.jspb.test.OuterMessage; -import Simple1 = proto.jspb.test.Simple1; -import Simple2 = proto.jspb.test.Simple2; -import SpecialCases = proto.jspb.test.SpecialCases; -import TestAllowAliasEnum = proto.jspb.test.TestAllowAliasEnum; -import TestClone = proto.jspb.test.TestClone; -import TestCloneExtension = proto.jspb.test.TestCloneExtension; -import TestEndsWithBytes = proto.jspb.test.TestEndsWithBytes; -import TestGroup = proto.jspb.test.TestGroup; -import TestGroup1 = proto.jspb.test.TestGroup1; -import TestLastFieldBeforePivot = proto.jspb.test.TestLastFieldBeforePivot; -import TestMapFieldsNoBinary = proto.jspb.test.TestMapFieldsNoBinary; -import TestMessageWithOneof = proto.jspb.test.TestMessageWithOneof; -import TestReservedNames = proto.jspb.test.TestReservedNames; -import TestReservedNamesExtension = proto.jspb.test.TestReservedNamesExtension; - -export { - BooleanFields, - CloneExtension, - Complex, - Deeply, - DefaultValues, - Empty, - EnumContainer, - FloatingPointFields, - HasExtensions, - IndirectExtension, - Int64Types, - IsExtension, - MapValueEnumNoBinary, - MapValueMessageNoBinary, - MineField, - OptionalFields, - OuterEnum, - OuterMessage, - Simple1, - Simple2, - SpecialCases, - TestAllowAliasEnum, - TestClone, - TestCloneExtension, - TestEndsWithBytes, - TestGroup, - TestGroup1, - TestLastFieldBeforePivot, - TestMapFieldsNoBinary, - TestMessageWithOneof, - TestReservedNames, - TestReservedNamesExtension, -}; diff --git a/example/test.js b/example/test.js index 6c46f57e..bec1e968 100644 --- a/example/test.js +++ b/example/test.js @@ -16,53 +16,6 @@ var goog = jspb; var proto = {}; import * as google_protobuf_descriptor_pb from 'google-protobuf/google/protobuf/descriptor.js'; -goog.exportSymbol('proto.jspb.test.BooleanFields', null, global); -goog.exportSymbol('proto.jspb.test.CloneExtension', null, global); -goog.exportSymbol('proto.jspb.test.Complex', null, global); -goog.exportSymbol('proto.jspb.test.Complex.Nested', null, global); -goog.exportSymbol('proto.jspb.test.Deeply', null, global); -goog.exportSymbol('proto.jspb.test.Deeply.Nested', null, global); -goog.exportSymbol('proto.jspb.test.Deeply.Nested.Message', null, global); -goog.exportSymbol('proto.jspb.test.DefaultValues', null, global); -goog.exportSymbol('proto.jspb.test.DefaultValues.Enum', null, global); -goog.exportSymbol('proto.jspb.test.Empty', null, global); -goog.exportSymbol('proto.jspb.test.EnumContainer', null, global); -goog.exportSymbol('proto.jspb.test.FloatingPointFields', null, global); -goog.exportSymbol('proto.jspb.test.HasExtensions', null, global); -goog.exportSymbol('proto.jspb.test.IndirectExtension', null, global); -goog.exportSymbol('proto.jspb.test.Int64Types', null, global); -goog.exportSymbol('proto.jspb.test.IsExtension', null, global); -goog.exportSymbol('proto.jspb.test.MapValueEnumNoBinary', null, global); -goog.exportSymbol('proto.jspb.test.MapValueMessageNoBinary', null, global); -goog.exportSymbol('proto.jspb.test.MineField', null, global); -goog.exportSymbol('proto.jspb.test.OptionalFields', null, global); -goog.exportSymbol('proto.jspb.test.OptionalFields.Nested', null, global); -goog.exportSymbol('proto.jspb.test.OuterEnum', null, global); -goog.exportSymbol('proto.jspb.test.OuterMessage', null, global); -goog.exportSymbol('proto.jspb.test.OuterMessage.Complex', null, global); -goog.exportSymbol('proto.jspb.test.Simple1', null, global); -goog.exportSymbol('proto.jspb.test.Simple2', null, global); -goog.exportSymbol('proto.jspb.test.SpecialCases', null, global); -goog.exportSymbol('proto.jspb.test.TestAllowAliasEnum', null, global); -goog.exportSymbol('proto.jspb.test.TestClone', null, global); -goog.exportSymbol('proto.jspb.test.TestCloneExtension', null, global); -goog.exportSymbol('proto.jspb.test.TestEndsWithBytes', null, global); -goog.exportSymbol('proto.jspb.test.TestGroup', null, global); -goog.exportSymbol('proto.jspb.test.TestGroup.OptionalGroup', null, global); -goog.exportSymbol('proto.jspb.test.TestGroup.RepeatedGroup', null, global); -goog.exportSymbol('proto.jspb.test.TestGroup.RequiredGroup', null, global); -goog.exportSymbol('proto.jspb.test.TestGroup1', null, global); -goog.exportSymbol('proto.jspb.test.TestLastFieldBeforePivot', null, global); -goog.exportSymbol('proto.jspb.test.TestMapFieldsNoBinary', null, global); -goog.exportSymbol('proto.jspb.test.TestMessageWithOneof', null, global); -goog.exportSymbol('proto.jspb.test.TestMessageWithOneof.DefaultOneofACase', null, global); -goog.exportSymbol('proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase', null, global); -goog.exportSymbol('proto.jspb.test.TestMessageWithOneof.PartialOneofCase', null, global); -goog.exportSymbol('proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase', null, global); -goog.exportSymbol('proto.jspb.test.TestReservedNames', null, global); -goog.exportSymbol('proto.jspb.test.TestReservedNamesExtension', null, global); -goog.exportSymbol('proto.jspb.test.extendTestLastFieldBeforePivotField', null, global); -goog.exportSymbol('proto.jspb.test.simple1', null, global); /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -73,16 +26,16 @@ goog.exportSymbol('proto.jspb.test.simple1', null, global); * @extends {jspb.Message} * @constructor */ -proto.jspb.test.Empty = function(opt_data) { +export function Empty(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.Empty, jspb.Message); +goog.inherits(Empty, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.Empty.displayName = 'proto.jspb.test.Empty'; + Empty.displayName = 'proto.jspb.test.Empty'; } /** * Generated by JsPbCodeGenerator. @@ -94,16 +47,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.EnumContainer = function(opt_data) { +export function EnumContainer(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.EnumContainer, jspb.Message); +goog.inherits(EnumContainer, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.EnumContainer.displayName = 'proto.jspb.test.EnumContainer'; + EnumContainer.displayName = 'proto.jspb.test.EnumContainer'; } /** * Generated by JsPbCodeGenerator. @@ -115,16 +68,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.Simple1 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.Simple1.repeatedFields_, null); +export function Simple1(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, Simple1.repeatedFields_, null); }; -goog.inherits(proto.jspb.test.Simple1, jspb.Message); +goog.inherits(Simple1, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.Simple1.displayName = 'proto.jspb.test.Simple1'; + Simple1.displayName = 'proto.jspb.test.Simple1'; } /** * Generated by JsPbCodeGenerator. @@ -136,16 +89,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.Simple2 = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.Simple2.repeatedFields_, null); +export function Simple2(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, Simple2.repeatedFields_, null); }; -goog.inherits(proto.jspb.test.Simple2, jspb.Message); +goog.inherits(Simple2, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.Simple2.displayName = 'proto.jspb.test.Simple2'; + Simple2.displayName = 'proto.jspb.test.Simple2'; } /** * Generated by JsPbCodeGenerator. @@ -157,16 +110,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.SpecialCases = function(opt_data) { +export function SpecialCases(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.SpecialCases, jspb.Message); +goog.inherits(SpecialCases, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.SpecialCases.displayName = 'proto.jspb.test.SpecialCases'; + SpecialCases.displayName = 'proto.jspb.test.SpecialCases'; } /** * Generated by JsPbCodeGenerator. @@ -178,16 +131,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.OptionalFields = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.OptionalFields.repeatedFields_, null); +export function OptionalFields(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, OptionalFields.repeatedFields_, null); }; -goog.inherits(proto.jspb.test.OptionalFields, jspb.Message); +goog.inherits(OptionalFields, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.OptionalFields.displayName = 'proto.jspb.test.OptionalFields'; + OptionalFields.displayName = 'proto.jspb.test.OptionalFields'; } /** * Generated by JsPbCodeGenerator. @@ -199,16 +152,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.OptionalFields.Nested = function(opt_data) { +OptionalFields.Nested = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.OptionalFields.Nested, jspb.Message); +goog.inherits(OptionalFields.Nested, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.OptionalFields.Nested.displayName = 'proto.jspb.test.OptionalFields.Nested'; + OptionalFields.Nested.displayName = 'proto.jspb.test.OptionalFields.Nested'; } /** * Generated by JsPbCodeGenerator. @@ -220,16 +173,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.HasExtensions = function(opt_data) { +export function HasExtensions(opt_data) { jspb.Message.initialize(this, opt_data, 0, 4, null, null); }; -goog.inherits(proto.jspb.test.HasExtensions, jspb.Message); +goog.inherits(HasExtensions, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.HasExtensions.displayName = 'proto.jspb.test.HasExtensions'; + HasExtensions.displayName = 'proto.jspb.test.HasExtensions'; } /** @@ -244,7 +197,7 @@ if (goog.DEBUG && !COMPILED) { * * @type {!Object} */ -proto.jspb.test.HasExtensions.extensions = {}; +HasExtensions.extensions = {}; /** @@ -259,7 +212,7 @@ proto.jspb.test.HasExtensions.extensions = {}; * * @type {!Object} */ -proto.jspb.test.HasExtensions.extensionsBinary = {}; +HasExtensions.extensionsBinary = {}; /** * Generated by JsPbCodeGenerator. @@ -271,16 +224,16 @@ proto.jspb.test.HasExtensions.extensionsBinary = {}; * @extends {jspb.Message} * @constructor */ -proto.jspb.test.Complex = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.Complex.repeatedFields_, null); +export function Complex(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, Complex.repeatedFields_, null); }; -goog.inherits(proto.jspb.test.Complex, jspb.Message); +goog.inherits(Complex, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.Complex.displayName = 'proto.jspb.test.Complex'; + Complex.displayName = 'proto.jspb.test.Complex'; } /** * Generated by JsPbCodeGenerator. @@ -292,16 +245,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.Complex.Nested = function(opt_data) { +Complex.Nested = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.Complex.Nested, jspb.Message); +goog.inherits(Complex.Nested, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.Complex.Nested.displayName = 'proto.jspb.test.Complex.Nested'; + Complex.Nested.displayName = 'proto.jspb.test.Complex.Nested'; } /** * Generated by JsPbCodeGenerator. @@ -313,16 +266,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.OuterMessage = function(opt_data) { +export function OuterMessage(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.OuterMessage, jspb.Message); +goog.inherits(OuterMessage, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.OuterMessage.displayName = 'proto.jspb.test.OuterMessage'; + OuterMessage.displayName = 'proto.jspb.test.OuterMessage'; } /** * Generated by JsPbCodeGenerator. @@ -334,16 +287,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.OuterMessage.Complex = function(opt_data) { +OuterMessage.Complex = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.OuterMessage.Complex, jspb.Message); +goog.inherits(OuterMessage.Complex, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.OuterMessage.Complex.displayName = 'proto.jspb.test.OuterMessage.Complex'; + OuterMessage.Complex.displayName = 'proto.jspb.test.OuterMessage.Complex'; } /** * Generated by JsPbCodeGenerator. @@ -355,16 +308,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.MineField = function(opt_data) { +export function MineField(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.MineField, jspb.Message); +goog.inherits(MineField, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.MineField.displayName = 'proto.jspb.test.MineField'; + MineField.displayName = 'proto.jspb.test.MineField'; } /** * Generated by JsPbCodeGenerator. @@ -376,16 +329,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.IsExtension = function(opt_data) { +export function IsExtension(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.IsExtension, jspb.Message); +goog.inherits(IsExtension, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.IsExtension.displayName = 'proto.jspb.test.IsExtension'; + IsExtension.displayName = 'proto.jspb.test.IsExtension'; } /** * Generated by JsPbCodeGenerator. @@ -397,16 +350,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.IndirectExtension = function(opt_data) { +export function IndirectExtension(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.IndirectExtension, jspb.Message); +goog.inherits(IndirectExtension, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.IndirectExtension.displayName = 'proto.jspb.test.IndirectExtension'; + IndirectExtension.displayName = 'proto.jspb.test.IndirectExtension'; } /** * Generated by JsPbCodeGenerator. @@ -418,16 +371,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.DefaultValues = function(opt_data) { +export function DefaultValues(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.DefaultValues, jspb.Message); +goog.inherits(DefaultValues, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.DefaultValues.displayName = 'proto.jspb.test.DefaultValues'; + DefaultValues.displayName = 'proto.jspb.test.DefaultValues'; } /** * Generated by JsPbCodeGenerator. @@ -439,16 +392,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.FloatingPointFields = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.FloatingPointFields.repeatedFields_, null); +export function FloatingPointFields(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, FloatingPointFields.repeatedFields_, null); }; -goog.inherits(proto.jspb.test.FloatingPointFields, jspb.Message); +goog.inherits(FloatingPointFields, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.FloatingPointFields.displayName = 'proto.jspb.test.FloatingPointFields'; + FloatingPointFields.displayName = 'proto.jspb.test.FloatingPointFields'; } /** * Generated by JsPbCodeGenerator. @@ -460,16 +413,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.BooleanFields = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.BooleanFields.repeatedFields_, null); +export function BooleanFields(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, BooleanFields.repeatedFields_, null); }; -goog.inherits(proto.jspb.test.BooleanFields, jspb.Message); +goog.inherits(BooleanFields, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.BooleanFields.displayName = 'proto.jspb.test.BooleanFields'; + BooleanFields.displayName = 'proto.jspb.test.BooleanFields'; } /** * Generated by JsPbCodeGenerator. @@ -481,16 +434,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestClone = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, 8, proto.jspb.test.TestClone.repeatedFields_, null); +export function TestClone(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 8, TestClone.repeatedFields_, null); }; -goog.inherits(proto.jspb.test.TestClone, jspb.Message); +goog.inherits(TestClone, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestClone.displayName = 'proto.jspb.test.TestClone'; + TestClone.displayName = 'proto.jspb.test.TestClone'; } /** @@ -505,7 +458,7 @@ if (goog.DEBUG && !COMPILED) { * * @type {!Object} */ -proto.jspb.test.TestClone.extensions = {}; +TestClone.extensions = {}; /** @@ -520,7 +473,7 @@ proto.jspb.test.TestClone.extensions = {}; * * @type {!Object} */ -proto.jspb.test.TestClone.extensionsBinary = {}; +TestClone.extensionsBinary = {}; /** * Generated by JsPbCodeGenerator. @@ -532,16 +485,16 @@ proto.jspb.test.TestClone.extensionsBinary = {}; * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestCloneExtension = function(opt_data) { +export function TestCloneExtension(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.TestCloneExtension, jspb.Message); +goog.inherits(TestCloneExtension, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestCloneExtension.displayName = 'proto.jspb.test.TestCloneExtension'; + TestCloneExtension.displayName = 'proto.jspb.test.TestCloneExtension'; } /** * Generated by JsPbCodeGenerator. @@ -553,16 +506,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.CloneExtension = function(opt_data) { +export function CloneExtension(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.CloneExtension, jspb.Message); +goog.inherits(CloneExtension, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.CloneExtension.displayName = 'proto.jspb.test.CloneExtension'; + CloneExtension.displayName = 'proto.jspb.test.CloneExtension'; } /** * Generated by JsPbCodeGenerator. @@ -574,16 +527,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestGroup = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.TestGroup.repeatedFields_, null); +export function TestGroup(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, TestGroup.repeatedFields_, null); }; -goog.inherits(proto.jspb.test.TestGroup, jspb.Message); +goog.inherits(TestGroup, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestGroup.displayName = 'proto.jspb.test.TestGroup'; + TestGroup.displayName = 'proto.jspb.test.TestGroup'; } /** * Generated by JsPbCodeGenerator. @@ -595,16 +548,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestGroup.RepeatedGroup = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.TestGroup.RepeatedGroup.repeatedFields_, null); +TestGroup.RepeatedGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, TestGroup.RepeatedGroup.repeatedFields_, null); }; -goog.inherits(proto.jspb.test.TestGroup.RepeatedGroup, jspb.Message); +goog.inherits(TestGroup.RepeatedGroup, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestGroup.RepeatedGroup.displayName = 'proto.jspb.test.TestGroup.RepeatedGroup'; + TestGroup.RepeatedGroup.displayName = 'proto.jspb.test.TestGroup.RepeatedGroup'; } /** * Generated by JsPbCodeGenerator. @@ -616,16 +569,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestGroup.RequiredGroup = function(opt_data) { +TestGroup.RequiredGroup = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.TestGroup.RequiredGroup, jspb.Message); +goog.inherits(TestGroup.RequiredGroup, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestGroup.RequiredGroup.displayName = 'proto.jspb.test.TestGroup.RequiredGroup'; + TestGroup.RequiredGroup.displayName = 'proto.jspb.test.TestGroup.RequiredGroup'; } /** * Generated by JsPbCodeGenerator. @@ -637,16 +590,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestGroup.OptionalGroup = function(opt_data) { +TestGroup.OptionalGroup = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.TestGroup.OptionalGroup, jspb.Message); +goog.inherits(TestGroup.OptionalGroup, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestGroup.OptionalGroup.displayName = 'proto.jspb.test.TestGroup.OptionalGroup'; + TestGroup.OptionalGroup.displayName = 'proto.jspb.test.TestGroup.OptionalGroup'; } /** * Generated by JsPbCodeGenerator. @@ -658,16 +611,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestGroup1 = function(opt_data) { +export function TestGroup1(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.TestGroup1, jspb.Message); +goog.inherits(TestGroup1, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestGroup1.displayName = 'proto.jspb.test.TestGroup1'; + TestGroup1.displayName = 'proto.jspb.test.TestGroup1'; } /** * Generated by JsPbCodeGenerator. @@ -679,16 +632,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestReservedNames = function(opt_data) { +export function TestReservedNames(opt_data) { jspb.Message.initialize(this, opt_data, 0, 2, null, null); }; -goog.inherits(proto.jspb.test.TestReservedNames, jspb.Message); +goog.inherits(TestReservedNames, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestReservedNames.displayName = 'proto.jspb.test.TestReservedNames'; + TestReservedNames.displayName = 'proto.jspb.test.TestReservedNames'; } /** @@ -703,7 +656,7 @@ if (goog.DEBUG && !COMPILED) { * * @type {!Object} */ -proto.jspb.test.TestReservedNames.extensions = {}; +TestReservedNames.extensions = {}; /** @@ -718,7 +671,7 @@ proto.jspb.test.TestReservedNames.extensions = {}; * * @type {!Object} */ -proto.jspb.test.TestReservedNames.extensionsBinary = {}; +TestReservedNames.extensionsBinary = {}; /** * Generated by JsPbCodeGenerator. @@ -730,16 +683,16 @@ proto.jspb.test.TestReservedNames.extensionsBinary = {}; * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestReservedNamesExtension = function(opt_data) { +export function TestReservedNamesExtension(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.TestReservedNamesExtension, jspb.Message); +goog.inherits(TestReservedNamesExtension, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestReservedNamesExtension.displayName = 'proto.jspb.test.TestReservedNamesExtension'; + TestReservedNamesExtension.displayName = 'proto.jspb.test.TestReservedNamesExtension'; } /** * Generated by JsPbCodeGenerator. @@ -751,16 +704,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestMessageWithOneof = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.TestMessageWithOneof.repeatedFields_, proto.jspb.test.TestMessageWithOneof.oneofGroups_); +export function TestMessageWithOneof(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, TestMessageWithOneof.repeatedFields_, TestMessageWithOneof.oneofGroups_); }; -goog.inherits(proto.jspb.test.TestMessageWithOneof, jspb.Message); +goog.inherits(TestMessageWithOneof, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestMessageWithOneof.displayName = 'proto.jspb.test.TestMessageWithOneof'; + TestMessageWithOneof.displayName = 'proto.jspb.test.TestMessageWithOneof'; } /** * Generated by JsPbCodeGenerator. @@ -772,16 +725,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestEndsWithBytes = function(opt_data) { +export function TestEndsWithBytes(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.TestEndsWithBytes, jspb.Message); +goog.inherits(TestEndsWithBytes, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestEndsWithBytes.displayName = 'proto.jspb.test.TestEndsWithBytes'; + TestEndsWithBytes.displayName = 'proto.jspb.test.TestEndsWithBytes'; } /** * Generated by JsPbCodeGenerator. @@ -793,16 +746,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestLastFieldBeforePivot = function(opt_data) { +export function TestLastFieldBeforePivot(opt_data) { jspb.Message.initialize(this, opt_data, 0, 2, null, null); }; -goog.inherits(proto.jspb.test.TestLastFieldBeforePivot, jspb.Message); +goog.inherits(TestLastFieldBeforePivot, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestLastFieldBeforePivot.displayName = 'proto.jspb.test.TestLastFieldBeforePivot'; + TestLastFieldBeforePivot.displayName = 'proto.jspb.test.TestLastFieldBeforePivot'; } /** @@ -817,7 +770,7 @@ if (goog.DEBUG && !COMPILED) { * * @type {!Object} */ -proto.jspb.test.TestLastFieldBeforePivot.extensions = {}; +TestLastFieldBeforePivot.extensions = {}; /** @@ -832,7 +785,7 @@ proto.jspb.test.TestLastFieldBeforePivot.extensions = {}; * * @type {!Object} */ -proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary = {}; +TestLastFieldBeforePivot.extensionsBinary = {}; /** * Generated by JsPbCodeGenerator. @@ -844,16 +797,16 @@ proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary = {}; * @extends {jspb.Message} * @constructor */ -proto.jspb.test.Int64Types = function(opt_data) { +export function Int64Types(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.Int64Types, jspb.Message); +goog.inherits(Int64Types, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.Int64Types.displayName = 'proto.jspb.test.Int64Types'; + Int64Types.displayName = 'proto.jspb.test.Int64Types'; } /** * Generated by JsPbCodeGenerator. @@ -865,16 +818,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.TestMapFieldsNoBinary = function(opt_data) { +export function TestMapFieldsNoBinary(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.TestMapFieldsNoBinary, jspb.Message); +goog.inherits(TestMapFieldsNoBinary, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.TestMapFieldsNoBinary.displayName = 'proto.jspb.test.TestMapFieldsNoBinary'; + TestMapFieldsNoBinary.displayName = 'proto.jspb.test.TestMapFieldsNoBinary'; } /** * Generated by JsPbCodeGenerator. @@ -886,16 +839,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.MapValueMessageNoBinary = function(opt_data) { +export function MapValueMessageNoBinary(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.MapValueMessageNoBinary, jspb.Message); +goog.inherits(MapValueMessageNoBinary, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.MapValueMessageNoBinary.displayName = 'proto.jspb.test.MapValueMessageNoBinary'; + MapValueMessageNoBinary.displayName = 'proto.jspb.test.MapValueMessageNoBinary'; } /** * Generated by JsPbCodeGenerator. @@ -907,16 +860,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.Deeply = function(opt_data) { +export function Deeply(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.Deeply, jspb.Message); +goog.inherits(Deeply, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.Deeply.displayName = 'proto.jspb.test.Deeply'; + Deeply.displayName = 'proto.jspb.test.Deeply'; } /** * Generated by JsPbCodeGenerator. @@ -928,16 +881,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.Deeply.Nested = function(opt_data) { +Deeply.Nested = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.Deeply.Nested, jspb.Message); +goog.inherits(Deeply.Nested, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.Deeply.Nested.displayName = 'proto.jspb.test.Deeply.Nested'; + Deeply.Nested.displayName = 'proto.jspb.test.Deeply.Nested'; } /** * Generated by JsPbCodeGenerator. @@ -949,16 +902,16 @@ if (goog.DEBUG && !COMPILED) { * @extends {jspb.Message} * @constructor */ -proto.jspb.test.Deeply.Nested.Message = function(opt_data) { +Deeply.Nested.Message = function(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; -goog.inherits(proto.jspb.test.Deeply.Nested.Message, jspb.Message); +goog.inherits(Deeply.Nested.Message, jspb.Message); if (goog.DEBUG && !COMPILED) { /** * @public * @override */ - proto.jspb.test.Deeply.Nested.Message.displayName = 'proto.jspb.test.Deeply.Nested.Message'; + Deeply.Nested.Message.displayName = 'proto.jspb.test.Deeply.Nested.Message'; } @@ -976,8 +929,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.Empty.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.Empty.toObject(opt_includeInstance, this); +Empty.prototype.toObject = function(opt_includeInstance) { + return Empty.toObject(opt_includeInstance, this); }; @@ -990,7 +943,7 @@ proto.jspb.test.Empty.prototype.toObject = function(opt_includeInstance) { * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Empty.toObject = function(includeInstance, msg) { +Empty.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -1008,10 +961,10 @@ proto.jspb.test.Empty.toObject = function(includeInstance, msg) { * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.Empty} */ -proto.jspb.test.Empty.deserializeBinary = function(bytes) { +Empty.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.Empty; - return proto.jspb.test.Empty.deserializeBinaryFromReader(msg, reader); + var msg = new Empty; + return Empty.deserializeBinaryFromReader(msg, reader); }; @@ -1022,7 +975,7 @@ proto.jspb.test.Empty.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.Empty} */ -proto.jspb.test.Empty.deserializeBinaryFromReader = function(msg, reader) { +Empty.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1042,9 +995,9 @@ proto.jspb.test.Empty.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.Empty.prototype.serializeBinary = function() { +Empty.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.Empty.serializeBinaryToWriter(this, writer); + Empty.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1056,7 +1009,7 @@ proto.jspb.test.Empty.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Empty.serializeBinaryToWriter = function(message, writer) { +Empty.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; @@ -1077,8 +1030,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.EnumContainer.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.EnumContainer.toObject(opt_includeInstance, this); +EnumContainer.prototype.toObject = function(opt_includeInstance) { + return EnumContainer.toObject(opt_includeInstance, this); }; @@ -1091,7 +1044,7 @@ proto.jspb.test.EnumContainer.prototype.toObject = function(opt_includeInstance) * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.EnumContainer.toObject = function(includeInstance, msg) { +EnumContainer.toObject = function(includeInstance, msg) { var f, obj = { outerEnum: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; @@ -1109,10 +1062,10 @@ outerEnum: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.EnumContainer} */ -proto.jspb.test.EnumContainer.deserializeBinary = function(bytes) { +EnumContainer.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.EnumContainer; - return proto.jspb.test.EnumContainer.deserializeBinaryFromReader(msg, reader); + var msg = new EnumContainer; + return EnumContainer.deserializeBinaryFromReader(msg, reader); }; @@ -1123,7 +1076,7 @@ proto.jspb.test.EnumContainer.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.EnumContainer} */ -proto.jspb.test.EnumContainer.deserializeBinaryFromReader = function(msg, reader) { +EnumContainer.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1147,9 +1100,9 @@ proto.jspb.test.EnumContainer.deserializeBinaryFromReader = function(msg, reader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.EnumContainer.prototype.serializeBinary = function() { +EnumContainer.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.EnumContainer.serializeBinaryToWriter(this, writer); + EnumContainer.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1161,7 +1114,7 @@ proto.jspb.test.EnumContainer.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.EnumContainer.serializeBinaryToWriter = function(message, writer) { +EnumContainer.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -1177,7 +1130,7 @@ proto.jspb.test.EnumContainer.serializeBinaryToWriter = function(message, writer * optional OuterEnum outer_enum = 1; * @return {!proto.jspb.test.OuterEnum} */ -proto.jspb.test.EnumContainer.prototype.getOuterEnum = function() { +EnumContainer.prototype.getOuterEnum = function() { return /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getFieldWithDefault(this, 1, 1)); }; @@ -1186,7 +1139,7 @@ proto.jspb.test.EnumContainer.prototype.getOuterEnum = function() { * @param {!proto.jspb.test.OuterEnum} value * @return {!proto.jspb.test.EnumContainer} returns this */ -proto.jspb.test.EnumContainer.prototype.setOuterEnum = function(value) { +EnumContainer.prototype.setOuterEnum = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -1195,7 +1148,7 @@ proto.jspb.test.EnumContainer.prototype.setOuterEnum = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.EnumContainer} returns this */ -proto.jspb.test.EnumContainer.prototype.clearOuterEnum = function() { +EnumContainer.prototype.clearOuterEnum = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -1204,7 +1157,7 @@ proto.jspb.test.EnumContainer.prototype.clearOuterEnum = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.EnumContainer.prototype.hasOuterEnum = function() { +EnumContainer.prototype.hasOuterEnum = function() { return jspb.Message.getField(this, 1) != null; }; @@ -1215,7 +1168,7 @@ proto.jspb.test.EnumContainer.prototype.hasOuterEnum = function() { * @private {!Array} * @const */ -proto.jspb.test.Simple1.repeatedFields_ = [2]; +Simple1.repeatedFields_ = [2]; @@ -1232,8 +1185,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.Simple1.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.Simple1.toObject(opt_includeInstance, this); +Simple1.prototype.toObject = function(opt_includeInstance) { + return Simple1.toObject(opt_includeInstance, this); }; @@ -1246,7 +1199,7 @@ proto.jspb.test.Simple1.prototype.toObject = function(opt_includeInstance) { * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Simple1.toObject = function(includeInstance, msg) { +Simple1.toObject = function(includeInstance, msg) { var f, obj = { aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f, @@ -1266,10 +1219,10 @@ aBoolean: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.Simple1} */ -proto.jspb.test.Simple1.deserializeBinary = function(bytes) { +Simple1.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.Simple1; - return proto.jspb.test.Simple1.deserializeBinaryFromReader(msg, reader); + var msg = new Simple1; + return Simple1.deserializeBinaryFromReader(msg, reader); }; @@ -1280,7 +1233,7 @@ proto.jspb.test.Simple1.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.Simple1} */ -proto.jspb.test.Simple1.deserializeBinaryFromReader = function(msg, reader) { +Simple1.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1312,9 +1265,9 @@ proto.jspb.test.Simple1.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.Simple1.prototype.serializeBinary = function() { +Simple1.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.Simple1.serializeBinaryToWriter(this, writer); + Simple1.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1326,7 +1279,7 @@ proto.jspb.test.Simple1.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Simple1.serializeBinaryToWriter = function(message, writer) { +Simple1.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -1356,7 +1309,7 @@ proto.jspb.test.Simple1.serializeBinaryToWriter = function(message, writer) { * required string a_string = 1; * @return {string} */ -proto.jspb.test.Simple1.prototype.getAString = function() { +Simple1.prototype.getAString = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; @@ -1365,7 +1318,7 @@ proto.jspb.test.Simple1.prototype.getAString = function() { * @param {string} value * @return {!proto.jspb.test.Simple1} returns this */ -proto.jspb.test.Simple1.prototype.setAString = function(value) { +Simple1.prototype.setAString = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -1374,7 +1327,7 @@ proto.jspb.test.Simple1.prototype.setAString = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.Simple1} returns this */ -proto.jspb.test.Simple1.prototype.clearAString = function() { +Simple1.prototype.clearAString = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -1383,7 +1336,7 @@ proto.jspb.test.Simple1.prototype.clearAString = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.Simple1.prototype.hasAString = function() { +Simple1.prototype.hasAString = function() { return jspb.Message.getField(this, 1) != null; }; @@ -1392,7 +1345,7 @@ proto.jspb.test.Simple1.prototype.hasAString = function() { * repeated string a_repeated_string = 2; * @return {!Array} */ -proto.jspb.test.Simple1.prototype.getARepeatedStringList = function() { +Simple1.prototype.getARepeatedStringList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; @@ -1401,7 +1354,7 @@ proto.jspb.test.Simple1.prototype.getARepeatedStringList = function() { * @param {!Array} value * @return {!proto.jspb.test.Simple1} returns this */ -proto.jspb.test.Simple1.prototype.setARepeatedStringList = function(value) { +Simple1.prototype.setARepeatedStringList = function(value) { return jspb.Message.setField(this, 2, value || []); }; @@ -1411,7 +1364,7 @@ proto.jspb.test.Simple1.prototype.setARepeatedStringList = function(value) { * @param {number=} opt_index * @return {!proto.jspb.test.Simple1} returns this */ -proto.jspb.test.Simple1.prototype.addARepeatedString = function(value, opt_index) { +Simple1.prototype.addARepeatedString = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; @@ -1420,7 +1373,7 @@ proto.jspb.test.Simple1.prototype.addARepeatedString = function(value, opt_index * Clears the list making it empty but non-null. * @return {!proto.jspb.test.Simple1} returns this */ -proto.jspb.test.Simple1.prototype.clearARepeatedStringList = function() { +Simple1.prototype.clearARepeatedStringList = function() { return this.setARepeatedStringList([]); }; @@ -1429,7 +1382,7 @@ proto.jspb.test.Simple1.prototype.clearARepeatedStringList = function() { * optional bool a_boolean = 3; * @return {boolean} */ -proto.jspb.test.Simple1.prototype.getABoolean = function() { +Simple1.prototype.getABoolean = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); }; @@ -1438,7 +1391,7 @@ proto.jspb.test.Simple1.prototype.getABoolean = function() { * @param {boolean} value * @return {!proto.jspb.test.Simple1} returns this */ -proto.jspb.test.Simple1.prototype.setABoolean = function(value) { +Simple1.prototype.setABoolean = function(value) { return jspb.Message.setField(this, 3, value); }; @@ -1447,7 +1400,7 @@ proto.jspb.test.Simple1.prototype.setABoolean = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.Simple1} returns this */ -proto.jspb.test.Simple1.prototype.clearABoolean = function() { +Simple1.prototype.clearABoolean = function() { return jspb.Message.setField(this, 3, undefined); }; @@ -1456,7 +1409,7 @@ proto.jspb.test.Simple1.prototype.clearABoolean = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.Simple1.prototype.hasABoolean = function() { +Simple1.prototype.hasABoolean = function() { return jspb.Message.getField(this, 3) != null; }; @@ -1467,7 +1420,7 @@ proto.jspb.test.Simple1.prototype.hasABoolean = function() { * @private {!Array} * @const */ -proto.jspb.test.Simple2.repeatedFields_ = [2]; +Simple2.repeatedFields_ = [2]; @@ -1484,8 +1437,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.Simple2.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.Simple2.toObject(opt_includeInstance, this); +Simple2.prototype.toObject = function(opt_includeInstance) { + return Simple2.toObject(opt_includeInstance, this); }; @@ -1498,7 +1451,7 @@ proto.jspb.test.Simple2.prototype.toObject = function(opt_includeInstance) { * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Simple2.toObject = function(includeInstance, msg) { +Simple2.toObject = function(includeInstance, msg) { var f, obj = { aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f @@ -1517,10 +1470,10 @@ aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undef * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.Simple2} */ -proto.jspb.test.Simple2.deserializeBinary = function(bytes) { +Simple2.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.Simple2; - return proto.jspb.test.Simple2.deserializeBinaryFromReader(msg, reader); + var msg = new Simple2; + return Simple2.deserializeBinaryFromReader(msg, reader); }; @@ -1531,7 +1484,7 @@ proto.jspb.test.Simple2.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.Simple2} */ -proto.jspb.test.Simple2.deserializeBinaryFromReader = function(msg, reader) { +Simple2.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1559,9 +1512,9 @@ proto.jspb.test.Simple2.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.Simple2.prototype.serializeBinary = function() { +Simple2.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.Simple2.serializeBinaryToWriter(this, writer); + Simple2.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1573,7 +1526,7 @@ proto.jspb.test.Simple2.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Simple2.serializeBinaryToWriter = function(message, writer) { +Simple2.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -1596,7 +1549,7 @@ proto.jspb.test.Simple2.serializeBinaryToWriter = function(message, writer) { * required string a_string = 1; * @return {string} */ -proto.jspb.test.Simple2.prototype.getAString = function() { +Simple2.prototype.getAString = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; @@ -1605,7 +1558,7 @@ proto.jspb.test.Simple2.prototype.getAString = function() { * @param {string} value * @return {!proto.jspb.test.Simple2} returns this */ -proto.jspb.test.Simple2.prototype.setAString = function(value) { +Simple2.prototype.setAString = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -1614,7 +1567,7 @@ proto.jspb.test.Simple2.prototype.setAString = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.Simple2} returns this */ -proto.jspb.test.Simple2.prototype.clearAString = function() { +Simple2.prototype.clearAString = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -1623,7 +1576,7 @@ proto.jspb.test.Simple2.prototype.clearAString = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.Simple2.prototype.hasAString = function() { +Simple2.prototype.hasAString = function() { return jspb.Message.getField(this, 1) != null; }; @@ -1632,7 +1585,7 @@ proto.jspb.test.Simple2.prototype.hasAString = function() { * repeated string a_repeated_string = 2; * @return {!Array} */ -proto.jspb.test.Simple2.prototype.getARepeatedStringList = function() { +Simple2.prototype.getARepeatedStringList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); }; @@ -1641,7 +1594,7 @@ proto.jspb.test.Simple2.prototype.getARepeatedStringList = function() { * @param {!Array} value * @return {!proto.jspb.test.Simple2} returns this */ -proto.jspb.test.Simple2.prototype.setARepeatedStringList = function(value) { +Simple2.prototype.setARepeatedStringList = function(value) { return jspb.Message.setField(this, 2, value || []); }; @@ -1651,7 +1604,7 @@ proto.jspb.test.Simple2.prototype.setARepeatedStringList = function(value) { * @param {number=} opt_index * @return {!proto.jspb.test.Simple2} returns this */ -proto.jspb.test.Simple2.prototype.addARepeatedString = function(value, opt_index) { +Simple2.prototype.addARepeatedString = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 2, value, opt_index); }; @@ -1660,7 +1613,7 @@ proto.jspb.test.Simple2.prototype.addARepeatedString = function(value, opt_index * Clears the list making it empty but non-null. * @return {!proto.jspb.test.Simple2} returns this */ -proto.jspb.test.Simple2.prototype.clearARepeatedStringList = function() { +Simple2.prototype.clearARepeatedStringList = function() { return this.setARepeatedStringList([]); }; @@ -1681,8 +1634,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.SpecialCases.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.SpecialCases.toObject(opt_includeInstance, this); +SpecialCases.prototype.toObject = function(opt_includeInstance) { + return SpecialCases.toObject(opt_includeInstance, this); }; @@ -1695,7 +1648,7 @@ proto.jspb.test.SpecialCases.prototype.toObject = function(opt_includeInstance) * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.SpecialCases.toObject = function(includeInstance, msg) { +SpecialCases.toObject = function(includeInstance, msg) { var f, obj = { normal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, pb_default: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, @@ -1716,10 +1669,10 @@ pb_var: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.SpecialCases} */ -proto.jspb.test.SpecialCases.deserializeBinary = function(bytes) { +SpecialCases.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.SpecialCases; - return proto.jspb.test.SpecialCases.deserializeBinaryFromReader(msg, reader); + var msg = new SpecialCases; + return SpecialCases.deserializeBinaryFromReader(msg, reader); }; @@ -1730,7 +1683,7 @@ proto.jspb.test.SpecialCases.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.SpecialCases} */ -proto.jspb.test.SpecialCases.deserializeBinaryFromReader = function(msg, reader) { +SpecialCases.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -1766,9 +1719,9 @@ proto.jspb.test.SpecialCases.deserializeBinaryFromReader = function(msg, reader) * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.SpecialCases.prototype.serializeBinary = function() { +SpecialCases.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.SpecialCases.serializeBinaryToWriter(this, writer); + SpecialCases.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -1780,7 +1733,7 @@ proto.jspb.test.SpecialCases.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.SpecialCases.serializeBinaryToWriter = function(message, writer) { +SpecialCases.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -1817,7 +1770,7 @@ proto.jspb.test.SpecialCases.serializeBinaryToWriter = function(message, writer) * required string normal = 1; * @return {string} */ -proto.jspb.test.SpecialCases.prototype.getNormal = function() { +SpecialCases.prototype.getNormal = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; @@ -1826,7 +1779,7 @@ proto.jspb.test.SpecialCases.prototype.getNormal = function() { * @param {string} value * @return {!proto.jspb.test.SpecialCases} returns this */ -proto.jspb.test.SpecialCases.prototype.setNormal = function(value) { +SpecialCases.prototype.setNormal = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -1835,7 +1788,7 @@ proto.jspb.test.SpecialCases.prototype.setNormal = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.SpecialCases} returns this */ -proto.jspb.test.SpecialCases.prototype.clearNormal = function() { +SpecialCases.prototype.clearNormal = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -1844,7 +1797,7 @@ proto.jspb.test.SpecialCases.prototype.clearNormal = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.SpecialCases.prototype.hasNormal = function() { +SpecialCases.prototype.hasNormal = function() { return jspb.Message.getField(this, 1) != null; }; @@ -1853,7 +1806,7 @@ proto.jspb.test.SpecialCases.prototype.hasNormal = function() { * required string default = 2; * @return {string} */ -proto.jspb.test.SpecialCases.prototype.getDefault = function() { +SpecialCases.prototype.getDefault = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; @@ -1862,7 +1815,7 @@ proto.jspb.test.SpecialCases.prototype.getDefault = function() { * @param {string} value * @return {!proto.jspb.test.SpecialCases} returns this */ -proto.jspb.test.SpecialCases.prototype.setDefault = function(value) { +SpecialCases.prototype.setDefault = function(value) { return jspb.Message.setField(this, 2, value); }; @@ -1871,7 +1824,7 @@ proto.jspb.test.SpecialCases.prototype.setDefault = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.SpecialCases} returns this */ -proto.jspb.test.SpecialCases.prototype.clearDefault = function() { +SpecialCases.prototype.clearDefault = function() { return jspb.Message.setField(this, 2, undefined); }; @@ -1880,7 +1833,7 @@ proto.jspb.test.SpecialCases.prototype.clearDefault = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.SpecialCases.prototype.hasDefault = function() { +SpecialCases.prototype.hasDefault = function() { return jspb.Message.getField(this, 2) != null; }; @@ -1889,7 +1842,7 @@ proto.jspb.test.SpecialCases.prototype.hasDefault = function() { * required string function = 3; * @return {string} */ -proto.jspb.test.SpecialCases.prototype.getFunction = function() { +SpecialCases.prototype.getFunction = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; @@ -1898,7 +1851,7 @@ proto.jspb.test.SpecialCases.prototype.getFunction = function() { * @param {string} value * @return {!proto.jspb.test.SpecialCases} returns this */ -proto.jspb.test.SpecialCases.prototype.setFunction = function(value) { +SpecialCases.prototype.setFunction = function(value) { return jspb.Message.setField(this, 3, value); }; @@ -1907,7 +1860,7 @@ proto.jspb.test.SpecialCases.prototype.setFunction = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.SpecialCases} returns this */ -proto.jspb.test.SpecialCases.prototype.clearFunction = function() { +SpecialCases.prototype.clearFunction = function() { return jspb.Message.setField(this, 3, undefined); }; @@ -1916,7 +1869,7 @@ proto.jspb.test.SpecialCases.prototype.clearFunction = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.SpecialCases.prototype.hasFunction = function() { +SpecialCases.prototype.hasFunction = function() { return jspb.Message.getField(this, 3) != null; }; @@ -1925,7 +1878,7 @@ proto.jspb.test.SpecialCases.prototype.hasFunction = function() { * required string var = 4; * @return {string} */ -proto.jspb.test.SpecialCases.prototype.getVar = function() { +SpecialCases.prototype.getVar = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; @@ -1934,7 +1887,7 @@ proto.jspb.test.SpecialCases.prototype.getVar = function() { * @param {string} value * @return {!proto.jspb.test.SpecialCases} returns this */ -proto.jspb.test.SpecialCases.prototype.setVar = function(value) { +SpecialCases.prototype.setVar = function(value) { return jspb.Message.setField(this, 4, value); }; @@ -1943,7 +1896,7 @@ proto.jspb.test.SpecialCases.prototype.setVar = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.SpecialCases} returns this */ -proto.jspb.test.SpecialCases.prototype.clearVar = function() { +SpecialCases.prototype.clearVar = function() { return jspb.Message.setField(this, 4, undefined); }; @@ -1952,7 +1905,7 @@ proto.jspb.test.SpecialCases.prototype.clearVar = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.SpecialCases.prototype.hasVar = function() { +SpecialCases.prototype.hasVar = function() { return jspb.Message.getField(this, 4) != null; }; @@ -1963,7 +1916,7 @@ proto.jspb.test.SpecialCases.prototype.hasVar = function() { * @private {!Array} * @const */ -proto.jspb.test.OptionalFields.repeatedFields_ = [4,5]; +OptionalFields.repeatedFields_ = [4,5]; @@ -1980,8 +1933,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.OptionalFields.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.OptionalFields.toObject(opt_includeInstance, this); +OptionalFields.prototype.toObject = function(opt_includeInstance) { + return OptionalFields.toObject(opt_includeInstance, this); }; @@ -1994,13 +1947,13 @@ proto.jspb.test.OptionalFields.prototype.toObject = function(opt_includeInstance * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.OptionalFields.toObject = function(includeInstance, msg) { +OptionalFields.toObject = function(includeInstance, msg) { var f, obj = { aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, aBool: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, -aNestedMessage: (f = msg.getANestedMessage()) && proto.jspb.test.OptionalFields.Nested.toObject(includeInstance, f), +aNestedMessage: (f = msg.getANestedMessage()) && OptionalFields.Nested.toObject(includeInstance, f), aRepeatedMessageList: jspb.Message.toObjectList(msg.getARepeatedMessageList(), - proto.jspb.test.OptionalFields.Nested.toObject, includeInstance), + OptionalFields.Nested.toObject, includeInstance), aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f }; @@ -2017,10 +1970,10 @@ aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undef * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.OptionalFields} */ -proto.jspb.test.OptionalFields.deserializeBinary = function(bytes) { +OptionalFields.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.OptionalFields; - return proto.jspb.test.OptionalFields.deserializeBinaryFromReader(msg, reader); + var msg = new OptionalFields; + return OptionalFields.deserializeBinaryFromReader(msg, reader); }; @@ -2031,7 +1984,7 @@ proto.jspb.test.OptionalFields.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.OptionalFields} */ -proto.jspb.test.OptionalFields.deserializeBinaryFromReader = function(msg, reader) { +OptionalFields.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2047,13 +2000,13 @@ proto.jspb.test.OptionalFields.deserializeBinaryFromReader = function(msg, reade msg.setABool(value); break; case 3: - var value = new proto.jspb.test.OptionalFields.Nested; - reader.readMessage(value,proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader); + var value = new OptionalFields.Nested; + reader.readMessage(value,OptionalFields.Nested.deserializeBinaryFromReader); msg.setANestedMessage(value); break; case 4: - var value = new proto.jspb.test.OptionalFields.Nested; - reader.readMessage(value,proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader); + var value = new OptionalFields.Nested; + reader.readMessage(value,OptionalFields.Nested.deserializeBinaryFromReader); msg.addARepeatedMessage(value); break; case 5: @@ -2073,9 +2026,9 @@ proto.jspb.test.OptionalFields.deserializeBinaryFromReader = function(msg, reade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.OptionalFields.prototype.serializeBinary = function() { +OptionalFields.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.OptionalFields.serializeBinaryToWriter(this, writer); + OptionalFields.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2087,7 +2040,7 @@ proto.jspb.test.OptionalFields.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.OptionalFields.serializeBinaryToWriter = function(message, writer) { +OptionalFields.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -2108,7 +2061,7 @@ proto.jspb.test.OptionalFields.serializeBinaryToWriter = function(message, write writer.writeMessage( 3, f, - proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter + OptionalFields.Nested.serializeBinaryToWriter ); } f = message.getARepeatedMessageList(); @@ -2116,7 +2069,7 @@ proto.jspb.test.OptionalFields.serializeBinaryToWriter = function(message, write writer.writeRepeatedMessage( 4, f, - proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter + OptionalFields.Nested.serializeBinaryToWriter ); } f = message.getARepeatedStringList(); @@ -2145,8 +2098,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.OptionalFields.Nested.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.OptionalFields.Nested.toObject(opt_includeInstance, this); +OptionalFields.Nested.prototype.toObject = function(opt_includeInstance) { + return OptionalFields.Nested.toObject(opt_includeInstance, this); }; @@ -2159,7 +2112,7 @@ proto.jspb.test.OptionalFields.Nested.prototype.toObject = function(opt_includeI * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.OptionalFields.Nested.toObject = function(includeInstance, msg) { +OptionalFields.Nested.toObject = function(includeInstance, msg) { var f, obj = { anInt: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; @@ -2177,10 +2130,10 @@ anInt: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.OptionalFields.Nested} */ -proto.jspb.test.OptionalFields.Nested.deserializeBinary = function(bytes) { +OptionalFields.Nested.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.OptionalFields.Nested; - return proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader(msg, reader); + var msg = new OptionalFields.Nested; + return OptionalFields.Nested.deserializeBinaryFromReader(msg, reader); }; @@ -2191,7 +2144,7 @@ proto.jspb.test.OptionalFields.Nested.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.OptionalFields.Nested} */ -proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader = function(msg, reader) { +OptionalFields.Nested.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2215,9 +2168,9 @@ proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader = function(msg * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.OptionalFields.Nested.prototype.serializeBinary = function() { +OptionalFields.Nested.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter(this, writer); + OptionalFields.Nested.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2229,7 +2182,7 @@ proto.jspb.test.OptionalFields.Nested.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter = function(message, writer) { +OptionalFields.Nested.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -2245,7 +2198,7 @@ proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter = function(message * optional int32 an_int = 1; * @return {number} */ -proto.jspb.test.OptionalFields.Nested.prototype.getAnInt = function() { +OptionalFields.Nested.prototype.getAnInt = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; @@ -2254,7 +2207,7 @@ proto.jspb.test.OptionalFields.Nested.prototype.getAnInt = function() { * @param {number} value * @return {!proto.jspb.test.OptionalFields.Nested} returns this */ -proto.jspb.test.OptionalFields.Nested.prototype.setAnInt = function(value) { +OptionalFields.Nested.prototype.setAnInt = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -2263,7 +2216,7 @@ proto.jspb.test.OptionalFields.Nested.prototype.setAnInt = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.OptionalFields.Nested} returns this */ -proto.jspb.test.OptionalFields.Nested.prototype.clearAnInt = function() { +OptionalFields.Nested.prototype.clearAnInt = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -2272,7 +2225,7 @@ proto.jspb.test.OptionalFields.Nested.prototype.clearAnInt = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.OptionalFields.Nested.prototype.hasAnInt = function() { +OptionalFields.Nested.prototype.hasAnInt = function() { return jspb.Message.getField(this, 1) != null; }; @@ -2281,7 +2234,7 @@ proto.jspb.test.OptionalFields.Nested.prototype.hasAnInt = function() { * optional string a_string = 1; * @return {string} */ -proto.jspb.test.OptionalFields.prototype.getAString = function() { +OptionalFields.prototype.getAString = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; @@ -2290,7 +2243,7 @@ proto.jspb.test.OptionalFields.prototype.getAString = function() { * @param {string} value * @return {!proto.jspb.test.OptionalFields} returns this */ -proto.jspb.test.OptionalFields.prototype.setAString = function(value) { +OptionalFields.prototype.setAString = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -2299,7 +2252,7 @@ proto.jspb.test.OptionalFields.prototype.setAString = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.OptionalFields} returns this */ -proto.jspb.test.OptionalFields.prototype.clearAString = function() { +OptionalFields.prototype.clearAString = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -2308,7 +2261,7 @@ proto.jspb.test.OptionalFields.prototype.clearAString = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.OptionalFields.prototype.hasAString = function() { +OptionalFields.prototype.hasAString = function() { return jspb.Message.getField(this, 1) != null; }; @@ -2317,7 +2270,7 @@ proto.jspb.test.OptionalFields.prototype.hasAString = function() { * required bool a_bool = 2; * @return {boolean} */ -proto.jspb.test.OptionalFields.prototype.getABool = function() { +OptionalFields.prototype.getABool = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; @@ -2326,7 +2279,7 @@ proto.jspb.test.OptionalFields.prototype.getABool = function() { * @param {boolean} value * @return {!proto.jspb.test.OptionalFields} returns this */ -proto.jspb.test.OptionalFields.prototype.setABool = function(value) { +OptionalFields.prototype.setABool = function(value) { return jspb.Message.setField(this, 2, value); }; @@ -2335,7 +2288,7 @@ proto.jspb.test.OptionalFields.prototype.setABool = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.OptionalFields} returns this */ -proto.jspb.test.OptionalFields.prototype.clearABool = function() { +OptionalFields.prototype.clearABool = function() { return jspb.Message.setField(this, 2, undefined); }; @@ -2344,7 +2297,7 @@ proto.jspb.test.OptionalFields.prototype.clearABool = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.OptionalFields.prototype.hasABool = function() { +OptionalFields.prototype.hasABool = function() { return jspb.Message.getField(this, 2) != null; }; @@ -2353,9 +2306,9 @@ proto.jspb.test.OptionalFields.prototype.hasABool = function() { * optional Nested a_nested_message = 3; * @return {?proto.jspb.test.OptionalFields.Nested} */ -proto.jspb.test.OptionalFields.prototype.getANestedMessage = function() { +OptionalFields.prototype.getANestedMessage = function() { return /** @type{?proto.jspb.test.OptionalFields.Nested} */ ( - jspb.Message.getWrapperField(this, proto.jspb.test.OptionalFields.Nested, 3)); + jspb.Message.getWrapperField(this, OptionalFields.Nested, 3)); }; @@ -2363,7 +2316,7 @@ proto.jspb.test.OptionalFields.prototype.getANestedMessage = function() { * @param {?proto.jspb.test.OptionalFields.Nested|undefined} value * @return {!proto.jspb.test.OptionalFields} returns this */ -proto.jspb.test.OptionalFields.prototype.setANestedMessage = function(value) { +OptionalFields.prototype.setANestedMessage = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; @@ -2372,7 +2325,7 @@ proto.jspb.test.OptionalFields.prototype.setANestedMessage = function(value) { * Clears the message field making it undefined. * @return {!proto.jspb.test.OptionalFields} returns this */ -proto.jspb.test.OptionalFields.prototype.clearANestedMessage = function() { +OptionalFields.prototype.clearANestedMessage = function() { return this.setANestedMessage(undefined); }; @@ -2381,7 +2334,7 @@ proto.jspb.test.OptionalFields.prototype.clearANestedMessage = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.OptionalFields.prototype.hasANestedMessage = function() { +OptionalFields.prototype.hasANestedMessage = function() { return jspb.Message.getField(this, 3) != null; }; @@ -2390,9 +2343,9 @@ proto.jspb.test.OptionalFields.prototype.hasANestedMessage = function() { * repeated Nested a_repeated_message = 4; * @return {!Array} */ -proto.jspb.test.OptionalFields.prototype.getARepeatedMessageList = function() { +OptionalFields.prototype.getARepeatedMessageList = function() { return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.OptionalFields.Nested, 4)); + jspb.Message.getRepeatedWrapperField(this, OptionalFields.Nested, 4)); }; @@ -2400,7 +2353,7 @@ proto.jspb.test.OptionalFields.prototype.getARepeatedMessageList = function() { * @param {!Array} value * @return {!proto.jspb.test.OptionalFields} returns this */ -proto.jspb.test.OptionalFields.prototype.setARepeatedMessageList = function(value) { +OptionalFields.prototype.setARepeatedMessageList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 4, value); }; @@ -2410,8 +2363,8 @@ proto.jspb.test.OptionalFields.prototype.setARepeatedMessageList = function(valu * @param {number=} opt_index * @return {!proto.jspb.test.OptionalFields.Nested} */ -proto.jspb.test.OptionalFields.prototype.addARepeatedMessage = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.jspb.test.OptionalFields.Nested, opt_index); +OptionalFields.prototype.addARepeatedMessage = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, OptionalFields.Nested, opt_index); }; @@ -2419,7 +2372,7 @@ proto.jspb.test.OptionalFields.prototype.addARepeatedMessage = function(opt_valu * Clears the list making it empty but non-null. * @return {!proto.jspb.test.OptionalFields} returns this */ -proto.jspb.test.OptionalFields.prototype.clearARepeatedMessageList = function() { +OptionalFields.prototype.clearARepeatedMessageList = function() { return this.setARepeatedMessageList([]); }; @@ -2428,7 +2381,7 @@ proto.jspb.test.OptionalFields.prototype.clearARepeatedMessageList = function() * repeated string a_repeated_string = 5; * @return {!Array} */ -proto.jspb.test.OptionalFields.prototype.getARepeatedStringList = function() { +OptionalFields.prototype.getARepeatedStringList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); }; @@ -2437,7 +2390,7 @@ proto.jspb.test.OptionalFields.prototype.getARepeatedStringList = function() { * @param {!Array} value * @return {!proto.jspb.test.OptionalFields} returns this */ -proto.jspb.test.OptionalFields.prototype.setARepeatedStringList = function(value) { +OptionalFields.prototype.setARepeatedStringList = function(value) { return jspb.Message.setField(this, 5, value || []); }; @@ -2447,7 +2400,7 @@ proto.jspb.test.OptionalFields.prototype.setARepeatedStringList = function(value * @param {number=} opt_index * @return {!proto.jspb.test.OptionalFields} returns this */ -proto.jspb.test.OptionalFields.prototype.addARepeatedString = function(value, opt_index) { +OptionalFields.prototype.addARepeatedString = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 5, value, opt_index); }; @@ -2456,7 +2409,7 @@ proto.jspb.test.OptionalFields.prototype.addARepeatedString = function(value, op * Clears the list making it empty but non-null. * @return {!proto.jspb.test.OptionalFields} returns this */ -proto.jspb.test.OptionalFields.prototype.clearARepeatedStringList = function() { +OptionalFields.prototype.clearARepeatedStringList = function() { return this.setARepeatedStringList([]); }; @@ -2477,8 +2430,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.HasExtensions.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.HasExtensions.toObject(opt_includeInstance, this); +HasExtensions.prototype.toObject = function(opt_includeInstance) { + return HasExtensions.toObject(opt_includeInstance, this); }; @@ -2491,7 +2444,7 @@ proto.jspb.test.HasExtensions.prototype.toObject = function(opt_includeInstance) * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.HasExtensions.toObject = function(includeInstance, msg) { +HasExtensions.toObject = function(includeInstance, msg) { var f, obj = { str1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, str2: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, @@ -2499,7 +2452,7 @@ str3: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f }; jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, - proto.jspb.test.HasExtensions.extensions, proto.jspb.test.HasExtensions.prototype.getExtension, + HasExtensions.extensions, HasExtensions.prototype.getExtension, includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; @@ -2514,10 +2467,10 @@ str3: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.HasExtensions} */ -proto.jspb.test.HasExtensions.deserializeBinary = function(bytes) { +HasExtensions.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.HasExtensions; - return proto.jspb.test.HasExtensions.deserializeBinaryFromReader(msg, reader); + var msg = new HasExtensions; + return HasExtensions.deserializeBinaryFromReader(msg, reader); }; @@ -2528,7 +2481,7 @@ proto.jspb.test.HasExtensions.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.HasExtensions} */ -proto.jspb.test.HasExtensions.deserializeBinaryFromReader = function(msg, reader) { +HasExtensions.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2549,9 +2502,9 @@ proto.jspb.test.HasExtensions.deserializeBinaryFromReader = function(msg, reader break; default: jspb.Message.readBinaryExtension(msg, reader, - proto.jspb.test.HasExtensions.extensionsBinary, - proto.jspb.test.HasExtensions.prototype.getExtension, - proto.jspb.test.HasExtensions.prototype.setExtension); + HasExtensions.extensionsBinary, + HasExtensions.prototype.getExtension, + HasExtensions.prototype.setExtension); break; } } @@ -2563,9 +2516,9 @@ proto.jspb.test.HasExtensions.deserializeBinaryFromReader = function(msg, reader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.HasExtensions.prototype.serializeBinary = function() { +HasExtensions.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.HasExtensions.serializeBinaryToWriter(this, writer); + HasExtensions.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2577,7 +2530,7 @@ proto.jspb.test.HasExtensions.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.HasExtensions.serializeBinaryToWriter = function(message, writer) { +HasExtensions.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -2601,7 +2554,7 @@ proto.jspb.test.HasExtensions.serializeBinaryToWriter = function(message, writer ); } jspb.Message.serializeBinaryExtensions(message, writer, - proto.jspb.test.HasExtensions.extensionsBinary, proto.jspb.test.HasExtensions.prototype.getExtension); + HasExtensions.extensionsBinary, HasExtensions.prototype.getExtension); }; @@ -2609,7 +2562,7 @@ proto.jspb.test.HasExtensions.serializeBinaryToWriter = function(message, writer * optional string str1 = 1; * @return {string} */ -proto.jspb.test.HasExtensions.prototype.getStr1 = function() { +HasExtensions.prototype.getStr1 = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; @@ -2618,7 +2571,7 @@ proto.jspb.test.HasExtensions.prototype.getStr1 = function() { * @param {string} value * @return {!proto.jspb.test.HasExtensions} returns this */ -proto.jspb.test.HasExtensions.prototype.setStr1 = function(value) { +HasExtensions.prototype.setStr1 = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -2627,7 +2580,7 @@ proto.jspb.test.HasExtensions.prototype.setStr1 = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.HasExtensions} returns this */ -proto.jspb.test.HasExtensions.prototype.clearStr1 = function() { +HasExtensions.prototype.clearStr1 = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -2636,7 +2589,7 @@ proto.jspb.test.HasExtensions.prototype.clearStr1 = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.HasExtensions.prototype.hasStr1 = function() { +HasExtensions.prototype.hasStr1 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -2645,7 +2598,7 @@ proto.jspb.test.HasExtensions.prototype.hasStr1 = function() { * optional string str2 = 2; * @return {string} */ -proto.jspb.test.HasExtensions.prototype.getStr2 = function() { +HasExtensions.prototype.getStr2 = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; @@ -2654,7 +2607,7 @@ proto.jspb.test.HasExtensions.prototype.getStr2 = function() { * @param {string} value * @return {!proto.jspb.test.HasExtensions} returns this */ -proto.jspb.test.HasExtensions.prototype.setStr2 = function(value) { +HasExtensions.prototype.setStr2 = function(value) { return jspb.Message.setField(this, 2, value); }; @@ -2663,7 +2616,7 @@ proto.jspb.test.HasExtensions.prototype.setStr2 = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.HasExtensions} returns this */ -proto.jspb.test.HasExtensions.prototype.clearStr2 = function() { +HasExtensions.prototype.clearStr2 = function() { return jspb.Message.setField(this, 2, undefined); }; @@ -2672,7 +2625,7 @@ proto.jspb.test.HasExtensions.prototype.clearStr2 = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.HasExtensions.prototype.hasStr2 = function() { +HasExtensions.prototype.hasStr2 = function() { return jspb.Message.getField(this, 2) != null; }; @@ -2681,7 +2634,7 @@ proto.jspb.test.HasExtensions.prototype.hasStr2 = function() { * optional string str3 = 3; * @return {string} */ -proto.jspb.test.HasExtensions.prototype.getStr3 = function() { +HasExtensions.prototype.getStr3 = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; @@ -2690,7 +2643,7 @@ proto.jspb.test.HasExtensions.prototype.getStr3 = function() { * @param {string} value * @return {!proto.jspb.test.HasExtensions} returns this */ -proto.jspb.test.HasExtensions.prototype.setStr3 = function(value) { +HasExtensions.prototype.setStr3 = function(value) { return jspb.Message.setField(this, 3, value); }; @@ -2699,7 +2652,7 @@ proto.jspb.test.HasExtensions.prototype.setStr3 = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.HasExtensions} returns this */ -proto.jspb.test.HasExtensions.prototype.clearStr3 = function() { +HasExtensions.prototype.clearStr3 = function() { return jspb.Message.setField(this, 3, undefined); }; @@ -2708,7 +2661,7 @@ proto.jspb.test.HasExtensions.prototype.clearStr3 = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.HasExtensions.prototype.hasStr3 = function() { +HasExtensions.prototype.hasStr3 = function() { return jspb.Message.getField(this, 3) != null; }; @@ -2719,7 +2672,7 @@ proto.jspb.test.HasExtensions.prototype.hasStr3 = function() { * @private {!Array} * @const */ -proto.jspb.test.Complex.repeatedFields_ = [5,7]; +Complex.repeatedFields_ = [5,7]; @@ -2736,8 +2689,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.Complex.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.Complex.toObject(opt_includeInstance, this); +Complex.prototype.toObject = function(opt_includeInstance) { + return Complex.toObject(opt_includeInstance, this); }; @@ -2750,13 +2703,13 @@ proto.jspb.test.Complex.prototype.toObject = function(opt_includeInstance) { * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Complex.toObject = function(includeInstance, msg) { +Complex.toObject = function(includeInstance, msg) { var f, obj = { aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, anOutOfOrderBool: (f = jspb.Message.getBooleanField(msg, 9)) == null ? undefined : f, -aNestedMessage: (f = msg.getANestedMessage()) && proto.jspb.test.Complex.Nested.toObject(includeInstance, f), +aNestedMessage: (f = msg.getANestedMessage()) && Complex.Nested.toObject(includeInstance, f), aRepeatedMessageList: jspb.Message.toObjectList(msg.getARepeatedMessageList(), - proto.jspb.test.Complex.Nested.toObject, includeInstance), + Complex.Nested.toObject, includeInstance), aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 7)) == null ? undefined : f, aFloatingPointField: (f = jspb.Message.getOptionalFloatingPointField(msg, 10)) == null ? undefined : f }; @@ -2774,10 +2727,10 @@ aFloatingPointField: (f = jspb.Message.getOptionalFloatingPointField(msg, 10)) = * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.Complex} */ -proto.jspb.test.Complex.deserializeBinary = function(bytes) { +Complex.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.Complex; - return proto.jspb.test.Complex.deserializeBinaryFromReader(msg, reader); + var msg = new Complex; + return Complex.deserializeBinaryFromReader(msg, reader); }; @@ -2788,7 +2741,7 @@ proto.jspb.test.Complex.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.Complex} */ -proto.jspb.test.Complex.deserializeBinaryFromReader = function(msg, reader) { +Complex.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2804,13 +2757,13 @@ proto.jspb.test.Complex.deserializeBinaryFromReader = function(msg, reader) { msg.setAnOutOfOrderBool(value); break; case 4: - var value = new proto.jspb.test.Complex.Nested; - reader.readMessage(value,proto.jspb.test.Complex.Nested.deserializeBinaryFromReader); + var value = new Complex.Nested; + reader.readMessage(value,Complex.Nested.deserializeBinaryFromReader); msg.setANestedMessage(value); break; case 5: - var value = new proto.jspb.test.Complex.Nested; - reader.readMessage(value,proto.jspb.test.Complex.Nested.deserializeBinaryFromReader); + var value = new Complex.Nested; + reader.readMessage(value,Complex.Nested.deserializeBinaryFromReader); msg.addARepeatedMessage(value); break; case 7: @@ -2834,9 +2787,9 @@ proto.jspb.test.Complex.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.Complex.prototype.serializeBinary = function() { +Complex.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.Complex.serializeBinaryToWriter(this, writer); + Complex.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2848,7 +2801,7 @@ proto.jspb.test.Complex.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Complex.serializeBinaryToWriter = function(message, writer) { +Complex.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -2869,7 +2822,7 @@ proto.jspb.test.Complex.serializeBinaryToWriter = function(message, writer) { writer.writeMessage( 4, f, - proto.jspb.test.Complex.Nested.serializeBinaryToWriter + Complex.Nested.serializeBinaryToWriter ); } f = message.getARepeatedMessageList(); @@ -2877,7 +2830,7 @@ proto.jspb.test.Complex.serializeBinaryToWriter = function(message, writer) { writer.writeRepeatedMessage( 5, f, - proto.jspb.test.Complex.Nested.serializeBinaryToWriter + Complex.Nested.serializeBinaryToWriter ); } f = message.getARepeatedStringList(); @@ -2913,8 +2866,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.Complex.Nested.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.Complex.Nested.toObject(opt_includeInstance, this); +Complex.Nested.prototype.toObject = function(opt_includeInstance) { + return Complex.Nested.toObject(opt_includeInstance, this); }; @@ -2927,7 +2880,7 @@ proto.jspb.test.Complex.Nested.prototype.toObject = function(opt_includeInstance * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Complex.Nested.toObject = function(includeInstance, msg) { +Complex.Nested.toObject = function(includeInstance, msg) { var f, obj = { anInt: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f }; @@ -2945,10 +2898,10 @@ anInt: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.Complex.Nested} */ -proto.jspb.test.Complex.Nested.deserializeBinary = function(bytes) { +Complex.Nested.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.Complex.Nested; - return proto.jspb.test.Complex.Nested.deserializeBinaryFromReader(msg, reader); + var msg = new Complex.Nested; + return Complex.Nested.deserializeBinaryFromReader(msg, reader); }; @@ -2959,7 +2912,7 @@ proto.jspb.test.Complex.Nested.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.Complex.Nested} */ -proto.jspb.test.Complex.Nested.deserializeBinaryFromReader = function(msg, reader) { +Complex.Nested.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -2983,9 +2936,9 @@ proto.jspb.test.Complex.Nested.deserializeBinaryFromReader = function(msg, reade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.Complex.Nested.prototype.serializeBinary = function() { +Complex.Nested.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.Complex.Nested.serializeBinaryToWriter(this, writer); + Complex.Nested.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -2997,7 +2950,7 @@ proto.jspb.test.Complex.Nested.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Complex.Nested.serializeBinaryToWriter = function(message, writer) { +Complex.Nested.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 2)); if (f != null) { @@ -3013,7 +2966,7 @@ proto.jspb.test.Complex.Nested.serializeBinaryToWriter = function(message, write * required int32 an_int = 2; * @return {number} */ -proto.jspb.test.Complex.Nested.prototype.getAnInt = function() { +Complex.Nested.prototype.getAnInt = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); }; @@ -3022,7 +2975,7 @@ proto.jspb.test.Complex.Nested.prototype.getAnInt = function() { * @param {number} value * @return {!proto.jspb.test.Complex.Nested} returns this */ -proto.jspb.test.Complex.Nested.prototype.setAnInt = function(value) { +Complex.Nested.prototype.setAnInt = function(value) { return jspb.Message.setField(this, 2, value); }; @@ -3031,7 +2984,7 @@ proto.jspb.test.Complex.Nested.prototype.setAnInt = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.Complex.Nested} returns this */ -proto.jspb.test.Complex.Nested.prototype.clearAnInt = function() { +Complex.Nested.prototype.clearAnInt = function() { return jspb.Message.setField(this, 2, undefined); }; @@ -3040,7 +2993,7 @@ proto.jspb.test.Complex.Nested.prototype.clearAnInt = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.Complex.Nested.prototype.hasAnInt = function() { +Complex.Nested.prototype.hasAnInt = function() { return jspb.Message.getField(this, 2) != null; }; @@ -3049,7 +3002,7 @@ proto.jspb.test.Complex.Nested.prototype.hasAnInt = function() { * required string a_string = 1; * @return {string} */ -proto.jspb.test.Complex.prototype.getAString = function() { +Complex.prototype.getAString = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; @@ -3058,7 +3011,7 @@ proto.jspb.test.Complex.prototype.getAString = function() { * @param {string} value * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.setAString = function(value) { +Complex.prototype.setAString = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -3067,7 +3020,7 @@ proto.jspb.test.Complex.prototype.setAString = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.clearAString = function() { +Complex.prototype.clearAString = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -3076,7 +3029,7 @@ proto.jspb.test.Complex.prototype.clearAString = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.Complex.prototype.hasAString = function() { +Complex.prototype.hasAString = function() { return jspb.Message.getField(this, 1) != null; }; @@ -3085,7 +3038,7 @@ proto.jspb.test.Complex.prototype.hasAString = function() { * optional bool an_out_of_order_bool = 9; * @return {boolean} */ -proto.jspb.test.Complex.prototype.getAnOutOfOrderBool = function() { +Complex.prototype.getAnOutOfOrderBool = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false)); }; @@ -3094,7 +3047,7 @@ proto.jspb.test.Complex.prototype.getAnOutOfOrderBool = function() { * @param {boolean} value * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.setAnOutOfOrderBool = function(value) { +Complex.prototype.setAnOutOfOrderBool = function(value) { return jspb.Message.setField(this, 9, value); }; @@ -3103,7 +3056,7 @@ proto.jspb.test.Complex.prototype.setAnOutOfOrderBool = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.clearAnOutOfOrderBool = function() { +Complex.prototype.clearAnOutOfOrderBool = function() { return jspb.Message.setField(this, 9, undefined); }; @@ -3112,7 +3065,7 @@ proto.jspb.test.Complex.prototype.clearAnOutOfOrderBool = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.Complex.prototype.hasAnOutOfOrderBool = function() { +Complex.prototype.hasAnOutOfOrderBool = function() { return jspb.Message.getField(this, 9) != null; }; @@ -3121,9 +3074,9 @@ proto.jspb.test.Complex.prototype.hasAnOutOfOrderBool = function() { * optional Nested a_nested_message = 4; * @return {?proto.jspb.test.Complex.Nested} */ -proto.jspb.test.Complex.prototype.getANestedMessage = function() { +Complex.prototype.getANestedMessage = function() { return /** @type{?proto.jspb.test.Complex.Nested} */ ( - jspb.Message.getWrapperField(this, proto.jspb.test.Complex.Nested, 4)); + jspb.Message.getWrapperField(this, Complex.Nested, 4)); }; @@ -3131,7 +3084,7 @@ proto.jspb.test.Complex.prototype.getANestedMessage = function() { * @param {?proto.jspb.test.Complex.Nested|undefined} value * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.setANestedMessage = function(value) { +Complex.prototype.setANestedMessage = function(value) { return jspb.Message.setWrapperField(this, 4, value); }; @@ -3140,7 +3093,7 @@ proto.jspb.test.Complex.prototype.setANestedMessage = function(value) { * Clears the message field making it undefined. * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.clearANestedMessage = function() { +Complex.prototype.clearANestedMessage = function() { return this.setANestedMessage(undefined); }; @@ -3149,7 +3102,7 @@ proto.jspb.test.Complex.prototype.clearANestedMessage = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.Complex.prototype.hasANestedMessage = function() { +Complex.prototype.hasANestedMessage = function() { return jspb.Message.getField(this, 4) != null; }; @@ -3158,9 +3111,9 @@ proto.jspb.test.Complex.prototype.hasANestedMessage = function() { * repeated Nested a_repeated_message = 5; * @return {!Array} */ -proto.jspb.test.Complex.prototype.getARepeatedMessageList = function() { +Complex.prototype.getARepeatedMessageList = function() { return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.Complex.Nested, 5)); + jspb.Message.getRepeatedWrapperField(this, Complex.Nested, 5)); }; @@ -3168,7 +3121,7 @@ proto.jspb.test.Complex.prototype.getARepeatedMessageList = function() { * @param {!Array} value * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.setARepeatedMessageList = function(value) { +Complex.prototype.setARepeatedMessageList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 5, value); }; @@ -3178,8 +3131,8 @@ proto.jspb.test.Complex.prototype.setARepeatedMessageList = function(value) { * @param {number=} opt_index * @return {!proto.jspb.test.Complex.Nested} */ -proto.jspb.test.Complex.prototype.addARepeatedMessage = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.jspb.test.Complex.Nested, opt_index); +Complex.prototype.addARepeatedMessage = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, Complex.Nested, opt_index); }; @@ -3187,7 +3140,7 @@ proto.jspb.test.Complex.prototype.addARepeatedMessage = function(opt_value, opt_ * Clears the list making it empty but non-null. * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.clearARepeatedMessageList = function() { +Complex.prototype.clearARepeatedMessageList = function() { return this.setARepeatedMessageList([]); }; @@ -3196,7 +3149,7 @@ proto.jspb.test.Complex.prototype.clearARepeatedMessageList = function() { * repeated string a_repeated_string = 7; * @return {!Array} */ -proto.jspb.test.Complex.prototype.getARepeatedStringList = function() { +Complex.prototype.getARepeatedStringList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 7)); }; @@ -3205,7 +3158,7 @@ proto.jspb.test.Complex.prototype.getARepeatedStringList = function() { * @param {!Array} value * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.setARepeatedStringList = function(value) { +Complex.prototype.setARepeatedStringList = function(value) { return jspb.Message.setField(this, 7, value || []); }; @@ -3215,7 +3168,7 @@ proto.jspb.test.Complex.prototype.setARepeatedStringList = function(value) { * @param {number=} opt_index * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.addARepeatedString = function(value, opt_index) { +Complex.prototype.addARepeatedString = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 7, value, opt_index); }; @@ -3224,7 +3177,7 @@ proto.jspb.test.Complex.prototype.addARepeatedString = function(value, opt_index * Clears the list making it empty but non-null. * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.clearARepeatedStringList = function() { +Complex.prototype.clearARepeatedStringList = function() { return this.setARepeatedStringList([]); }; @@ -3233,7 +3186,7 @@ proto.jspb.test.Complex.prototype.clearARepeatedStringList = function() { * optional double a_floating_point_field = 10; * @return {number} */ -proto.jspb.test.Complex.prototype.getAFloatingPointField = function() { +Complex.prototype.getAFloatingPointField = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 10, 0.0)); }; @@ -3242,7 +3195,7 @@ proto.jspb.test.Complex.prototype.getAFloatingPointField = function() { * @param {number} value * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.setAFloatingPointField = function(value) { +Complex.prototype.setAFloatingPointField = function(value) { return jspb.Message.setField(this, 10, value); }; @@ -3251,7 +3204,7 @@ proto.jspb.test.Complex.prototype.setAFloatingPointField = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.Complex} returns this */ -proto.jspb.test.Complex.prototype.clearAFloatingPointField = function() { +Complex.prototype.clearAFloatingPointField = function() { return jspb.Message.setField(this, 10, undefined); }; @@ -3260,7 +3213,7 @@ proto.jspb.test.Complex.prototype.clearAFloatingPointField = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.Complex.prototype.hasAFloatingPointField = function() { +Complex.prototype.hasAFloatingPointField = function() { return jspb.Message.getField(this, 10) != null; }; @@ -3281,8 +3234,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.OuterMessage.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.OuterMessage.toObject(opt_includeInstance, this); +OuterMessage.prototype.toObject = function(opt_includeInstance) { + return OuterMessage.toObject(opt_includeInstance, this); }; @@ -3295,7 +3248,7 @@ proto.jspb.test.OuterMessage.prototype.toObject = function(opt_includeInstance) * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.OuterMessage.toObject = function(includeInstance, msg) { +OuterMessage.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -3313,10 +3266,10 @@ proto.jspb.test.OuterMessage.toObject = function(includeInstance, msg) { * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.OuterMessage} */ -proto.jspb.test.OuterMessage.deserializeBinary = function(bytes) { +OuterMessage.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.OuterMessage; - return proto.jspb.test.OuterMessage.deserializeBinaryFromReader(msg, reader); + var msg = new OuterMessage; + return OuterMessage.deserializeBinaryFromReader(msg, reader); }; @@ -3327,7 +3280,7 @@ proto.jspb.test.OuterMessage.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.OuterMessage} */ -proto.jspb.test.OuterMessage.deserializeBinaryFromReader = function(msg, reader) { +OuterMessage.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3347,9 +3300,9 @@ proto.jspb.test.OuterMessage.deserializeBinaryFromReader = function(msg, reader) * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.OuterMessage.prototype.serializeBinary = function() { +OuterMessage.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.OuterMessage.serializeBinaryToWriter(this, writer); + OuterMessage.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3361,7 +3314,7 @@ proto.jspb.test.OuterMessage.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.OuterMessage.serializeBinaryToWriter = function(message, writer) { +OuterMessage.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; @@ -3382,8 +3335,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.OuterMessage.Complex.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.OuterMessage.Complex.toObject(opt_includeInstance, this); +OuterMessage.Complex.prototype.toObject = function(opt_includeInstance) { + return OuterMessage.Complex.toObject(opt_includeInstance, this); }; @@ -3396,7 +3349,7 @@ proto.jspb.test.OuterMessage.Complex.prototype.toObject = function(opt_includeIn * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.OuterMessage.Complex.toObject = function(includeInstance, msg) { +OuterMessage.Complex.toObject = function(includeInstance, msg) { var f, obj = { innerComplexField: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; @@ -3414,10 +3367,10 @@ innerComplexField: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.OuterMessage.Complex} */ -proto.jspb.test.OuterMessage.Complex.deserializeBinary = function(bytes) { +OuterMessage.Complex.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.OuterMessage.Complex; - return proto.jspb.test.OuterMessage.Complex.deserializeBinaryFromReader(msg, reader); + var msg = new OuterMessage.Complex; + return OuterMessage.Complex.deserializeBinaryFromReader(msg, reader); }; @@ -3428,7 +3381,7 @@ proto.jspb.test.OuterMessage.Complex.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.OuterMessage.Complex} */ -proto.jspb.test.OuterMessage.Complex.deserializeBinaryFromReader = function(msg, reader) { +OuterMessage.Complex.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3452,9 +3405,9 @@ proto.jspb.test.OuterMessage.Complex.deserializeBinaryFromReader = function(msg, * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.OuterMessage.Complex.prototype.serializeBinary = function() { +OuterMessage.Complex.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.OuterMessage.Complex.serializeBinaryToWriter(this, writer); + OuterMessage.Complex.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3466,7 +3419,7 @@ proto.jspb.test.OuterMessage.Complex.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.OuterMessage.Complex.serializeBinaryToWriter = function(message, writer) { +OuterMessage.Complex.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -3482,7 +3435,7 @@ proto.jspb.test.OuterMessage.Complex.serializeBinaryToWriter = function(message, * optional int32 inner_complex_field = 1; * @return {number} */ -proto.jspb.test.OuterMessage.Complex.prototype.getInnerComplexField = function() { +OuterMessage.Complex.prototype.getInnerComplexField = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; @@ -3491,7 +3444,7 @@ proto.jspb.test.OuterMessage.Complex.prototype.getInnerComplexField = function() * @param {number} value * @return {!proto.jspb.test.OuterMessage.Complex} returns this */ -proto.jspb.test.OuterMessage.Complex.prototype.setInnerComplexField = function(value) { +OuterMessage.Complex.prototype.setInnerComplexField = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -3500,7 +3453,7 @@ proto.jspb.test.OuterMessage.Complex.prototype.setInnerComplexField = function(v * Clears the field making it undefined. * @return {!proto.jspb.test.OuterMessage.Complex} returns this */ -proto.jspb.test.OuterMessage.Complex.prototype.clearInnerComplexField = function() { +OuterMessage.Complex.prototype.clearInnerComplexField = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -3509,7 +3462,7 @@ proto.jspb.test.OuterMessage.Complex.prototype.clearInnerComplexField = function * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.OuterMessage.Complex.prototype.hasInnerComplexField = function() { +OuterMessage.Complex.prototype.hasInnerComplexField = function() { return jspb.Message.getField(this, 1) != null; }; @@ -3530,8 +3483,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.MineField.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.MineField.toObject(opt_includeInstance, this); +MineField.prototype.toObject = function(opt_includeInstance) { + return MineField.toObject(opt_includeInstance, this); }; @@ -3544,7 +3497,7 @@ proto.jspb.test.MineField.prototype.toObject = function(opt_includeInstance) { * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.MineField.toObject = function(includeInstance, msg) { +MineField.toObject = function(includeInstance, msg) { var f, obj = { cookie: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; @@ -3562,10 +3515,10 @@ cookie: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.MineField} */ -proto.jspb.test.MineField.deserializeBinary = function(bytes) { +MineField.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.MineField; - return proto.jspb.test.MineField.deserializeBinaryFromReader(msg, reader); + var msg = new MineField; + return MineField.deserializeBinaryFromReader(msg, reader); }; @@ -3576,7 +3529,7 @@ proto.jspb.test.MineField.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.MineField} */ -proto.jspb.test.MineField.deserializeBinaryFromReader = function(msg, reader) { +MineField.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3600,9 +3553,9 @@ proto.jspb.test.MineField.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.MineField.prototype.serializeBinary = function() { +MineField.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.MineField.serializeBinaryToWriter(this, writer); + MineField.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3614,7 +3567,7 @@ proto.jspb.test.MineField.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.MineField.serializeBinaryToWriter = function(message, writer) { +MineField.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -3630,7 +3583,7 @@ proto.jspb.test.MineField.serializeBinaryToWriter = function(message, writer) { * optional string cookie = 1; * @return {string} */ -proto.jspb.test.MineField.prototype.getCookie = function() { +MineField.prototype.getCookie = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; @@ -3639,7 +3592,7 @@ proto.jspb.test.MineField.prototype.getCookie = function() { * @param {string} value * @return {!proto.jspb.test.MineField} returns this */ -proto.jspb.test.MineField.prototype.setCookie = function(value) { +MineField.prototype.setCookie = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -3648,7 +3601,7 @@ proto.jspb.test.MineField.prototype.setCookie = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.MineField} returns this */ -proto.jspb.test.MineField.prototype.clearCookie = function() { +MineField.prototype.clearCookie = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -3657,7 +3610,7 @@ proto.jspb.test.MineField.prototype.clearCookie = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.MineField.prototype.hasCookie = function() { +MineField.prototype.hasCookie = function() { return jspb.Message.getField(this, 1) != null; }; @@ -3678,8 +3631,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.IsExtension.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.IsExtension.toObject(opt_includeInstance, this); +IsExtension.prototype.toObject = function(opt_includeInstance) { + return IsExtension.toObject(opt_includeInstance, this); }; @@ -3692,7 +3645,7 @@ proto.jspb.test.IsExtension.prototype.toObject = function(opt_includeInstance) { * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.IsExtension.toObject = function(includeInstance, msg) { +IsExtension.toObject = function(includeInstance, msg) { var f, obj = { ext1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; @@ -3710,10 +3663,10 @@ ext1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.IsExtension} */ -proto.jspb.test.IsExtension.deserializeBinary = function(bytes) { +IsExtension.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.IsExtension; - return proto.jspb.test.IsExtension.deserializeBinaryFromReader(msg, reader); + var msg = new IsExtension; + return IsExtension.deserializeBinaryFromReader(msg, reader); }; @@ -3724,7 +3677,7 @@ proto.jspb.test.IsExtension.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.IsExtension} */ -proto.jspb.test.IsExtension.deserializeBinaryFromReader = function(msg, reader) { +IsExtension.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3748,9 +3701,9 @@ proto.jspb.test.IsExtension.deserializeBinaryFromReader = function(msg, reader) * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.IsExtension.prototype.serializeBinary = function() { +IsExtension.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.IsExtension.serializeBinaryToWriter(this, writer); + IsExtension.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3762,7 +3715,7 @@ proto.jspb.test.IsExtension.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.IsExtension.serializeBinaryToWriter = function(message, writer) { +IsExtension.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -3780,30 +3733,30 @@ proto.jspb.test.IsExtension.serializeBinaryToWriter = function(message, writer) * field named `extField`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.IsExtension.extField = new jspb.ExtensionFieldInfo( +IsExtension.extField = new jspb.ExtensionFieldInfo( 100, {extField: 0}, - proto.jspb.test.IsExtension, + IsExtension, /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - proto.jspb.test.IsExtension.toObject), + IsExtension.toObject), 0); -proto.jspb.test.HasExtensions.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.IsExtension.extField, +HasExtensions.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + IsExtension.extField, jspb.BinaryReader.prototype.readMessage, jspb.BinaryWriter.prototype.writeMessage, - proto.jspb.test.IsExtension.serializeBinaryToWriter, - proto.jspb.test.IsExtension.deserializeBinaryFromReader, + IsExtension.serializeBinaryToWriter, + IsExtension.deserializeBinaryFromReader, false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.HasExtensions.extensions[100] = proto.jspb.test.IsExtension.extField; +HasExtensions.extensions[100] = IsExtension.extField; /** * optional string ext1 = 1; * @return {string} */ -proto.jspb.test.IsExtension.prototype.getExt1 = function() { +IsExtension.prototype.getExt1 = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; @@ -3812,7 +3765,7 @@ proto.jspb.test.IsExtension.prototype.getExt1 = function() { * @param {string} value * @return {!proto.jspb.test.IsExtension} returns this */ -proto.jspb.test.IsExtension.prototype.setExt1 = function(value) { +IsExtension.prototype.setExt1 = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -3821,7 +3774,7 @@ proto.jspb.test.IsExtension.prototype.setExt1 = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.IsExtension} returns this */ -proto.jspb.test.IsExtension.prototype.clearExt1 = function() { +IsExtension.prototype.clearExt1 = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -3830,7 +3783,7 @@ proto.jspb.test.IsExtension.prototype.clearExt1 = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.IsExtension.prototype.hasExt1 = function() { +IsExtension.prototype.hasExt1 = function() { return jspb.Message.getField(this, 1) != null; }; @@ -3841,24 +3794,24 @@ proto.jspb.test.IsExtension.prototype.hasExt1 = function() { * field named `extField`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.IsExtension.extField = new jspb.ExtensionFieldInfo( +IsExtension.extField = new jspb.ExtensionFieldInfo( 100, {extField: 0}, - proto.jspb.test.IsExtension, + IsExtension, /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - proto.jspb.test.IsExtension.toObject), + IsExtension.toObject), 0); -proto.jspb.test.HasExtensions.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.IsExtension.extField, +HasExtensions.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + IsExtension.extField, jspb.BinaryReader.prototype.readMessage, jspb.BinaryWriter.prototype.writeMessage, - proto.jspb.test.IsExtension.serializeBinaryToWriter, - proto.jspb.test.IsExtension.deserializeBinaryFromReader, + IsExtension.serializeBinaryToWriter, + IsExtension.deserializeBinaryFromReader, false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.HasExtensions.extensions[100] = proto.jspb.test.IsExtension.extField; +HasExtensions.extensions[100] = IsExtension.extField; /** @@ -3866,7 +3819,7 @@ proto.jspb.test.HasExtensions.extensions[100] = proto.jspb.test.IsExtension.extF * field named `simpleOption`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.IsExtension.simpleOption = new jspb.ExtensionFieldInfo( +IsExtension.simpleOption = new jspb.ExtensionFieldInfo( 42113038, {simpleOption: 0}, null, @@ -3875,7 +3828,7 @@ proto.jspb.test.IsExtension.simpleOption = new jspb.ExtensionFieldInfo( 0); google_protobuf_descriptor_pb.EnumOptions.extensionsBinary[42113038] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.IsExtension.simpleOption, + IsExtension.simpleOption, jspb.BinaryReader.prototype.readString, jspb.BinaryWriter.prototype.writeString, undefined, @@ -3883,7 +3836,7 @@ google_protobuf_descriptor_pb.EnumOptions.extensionsBinary[42113038] = new jspb. false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -google_protobuf_descriptor_pb.EnumOptions.extensions[42113038] = proto.jspb.test.IsExtension.simpleOption; +google_protobuf_descriptor_pb.EnumOptions.extensions[42113038] = IsExtension.simpleOption; @@ -3901,8 +3854,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.IndirectExtension.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.IndirectExtension.toObject(opt_includeInstance, this); +IndirectExtension.prototype.toObject = function(opt_includeInstance) { + return IndirectExtension.toObject(opt_includeInstance, this); }; @@ -3915,7 +3868,7 @@ proto.jspb.test.IndirectExtension.prototype.toObject = function(opt_includeInsta * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.IndirectExtension.toObject = function(includeInstance, msg) { +IndirectExtension.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -3933,10 +3886,10 @@ proto.jspb.test.IndirectExtension.toObject = function(includeInstance, msg) { * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.IndirectExtension} */ -proto.jspb.test.IndirectExtension.deserializeBinary = function(bytes) { +IndirectExtension.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.IndirectExtension; - return proto.jspb.test.IndirectExtension.deserializeBinaryFromReader(msg, reader); + var msg = new IndirectExtension; + return IndirectExtension.deserializeBinaryFromReader(msg, reader); }; @@ -3947,7 +3900,7 @@ proto.jspb.test.IndirectExtension.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.IndirectExtension} */ -proto.jspb.test.IndirectExtension.deserializeBinaryFromReader = function(msg, reader) { +IndirectExtension.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -3967,9 +3920,9 @@ proto.jspb.test.IndirectExtension.deserializeBinaryFromReader = function(msg, re * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.IndirectExtension.prototype.serializeBinary = function() { +IndirectExtension.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.IndirectExtension.serializeBinaryToWriter(this, writer); + IndirectExtension.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -3981,7 +3934,7 @@ proto.jspb.test.IndirectExtension.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.IndirectExtension.serializeBinaryToWriter = function(message, writer) { +IndirectExtension.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; @@ -3992,24 +3945,24 @@ proto.jspb.test.IndirectExtension.serializeBinaryToWriter = function(message, wr * field named `simple`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.IndirectExtension.simple = new jspb.ExtensionFieldInfo( +IndirectExtension.simple = new jspb.ExtensionFieldInfo( 101, {simple: 0}, - proto.jspb.test.Simple1, + Simple1, /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - proto.jspb.test.Simple1.toObject), + Simple1.toObject), 0); -proto.jspb.test.HasExtensions.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.IndirectExtension.simple, +HasExtensions.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + IndirectExtension.simple, jspb.BinaryReader.prototype.readMessage, jspb.BinaryWriter.prototype.writeMessage, - proto.jspb.test.Simple1.serializeBinaryToWriter, - proto.jspb.test.Simple1.deserializeBinaryFromReader, + Simple1.serializeBinaryToWriter, + Simple1.deserializeBinaryFromReader, false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.HasExtensions.extensions[101] = proto.jspb.test.IndirectExtension.simple; +HasExtensions.extensions[101] = IndirectExtension.simple; /** @@ -4017,7 +3970,7 @@ proto.jspb.test.HasExtensions.extensions[101] = proto.jspb.test.IndirectExtensio * field named `str`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.IndirectExtension.str = new jspb.ExtensionFieldInfo( +IndirectExtension.str = new jspb.ExtensionFieldInfo( 102, {str: 0}, null, @@ -4025,8 +3978,8 @@ proto.jspb.test.IndirectExtension.str = new jspb.ExtensionFieldInfo( null), 0); -proto.jspb.test.HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.IndirectExtension.str, +HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( + IndirectExtension.str, jspb.BinaryReader.prototype.readString, jspb.BinaryWriter.prototype.writeString, undefined, @@ -4034,7 +3987,7 @@ proto.jspb.test.HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBin false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.HasExtensions.extensions[102] = proto.jspb.test.IndirectExtension.str; +HasExtensions.extensions[102] = IndirectExtension.str; /** @@ -4042,7 +3995,7 @@ proto.jspb.test.HasExtensions.extensions[102] = proto.jspb.test.IndirectExtensio * field named `repeatedStrList`. * @type {!jspb.ExtensionFieldInfo>} */ -proto.jspb.test.IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( +IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( 103, {repeatedStrList: 0}, null, @@ -4050,8 +4003,8 @@ proto.jspb.test.IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( null), 1); -proto.jspb.test.HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.IndirectExtension.repeatedStrList, +HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBinaryInfo( + IndirectExtension.repeatedStrList, jspb.BinaryReader.prototype.readString, jspb.BinaryWriter.prototype.writeRepeatedString, undefined, @@ -4059,7 +4012,7 @@ proto.jspb.test.HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBin false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.HasExtensions.extensions[103] = proto.jspb.test.IndirectExtension.repeatedStrList; +HasExtensions.extensions[103] = IndirectExtension.repeatedStrList; /** @@ -4067,24 +4020,24 @@ proto.jspb.test.HasExtensions.extensions[103] = proto.jspb.test.IndirectExtensio * field named `repeatedSimpleList`. * @type {!jspb.ExtensionFieldInfo>} */ -proto.jspb.test.IndirectExtension.repeatedSimpleList = new jspb.ExtensionFieldInfo( +IndirectExtension.repeatedSimpleList = new jspb.ExtensionFieldInfo( 104, {repeatedSimpleList: 0}, - proto.jspb.test.Simple1, + Simple1, /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - proto.jspb.test.Simple1.toObject), + Simple1.toObject), 1); -proto.jspb.test.HasExtensions.extensionsBinary[104] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.IndirectExtension.repeatedSimpleList, +HasExtensions.extensionsBinary[104] = new jspb.ExtensionFieldBinaryInfo( + IndirectExtension.repeatedSimpleList, jspb.BinaryReader.prototype.readMessage, jspb.BinaryWriter.prototype.writeRepeatedMessage, - proto.jspb.test.Simple1.serializeBinaryToWriter, - proto.jspb.test.Simple1.deserializeBinaryFromReader, + Simple1.serializeBinaryToWriter, + Simple1.deserializeBinaryFromReader, false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.HasExtensions.extensions[104] = proto.jspb.test.IndirectExtension.repeatedSimpleList; +HasExtensions.extensions[104] = IndirectExtension.repeatedSimpleList; /** @@ -4092,24 +4045,24 @@ proto.jspb.test.HasExtensions.extensions[104] = proto.jspb.test.IndirectExtensio * field named `simple`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.IndirectExtension.simple = new jspb.ExtensionFieldInfo( +IndirectExtension.simple = new jspb.ExtensionFieldInfo( 101, {simple: 0}, - proto.jspb.test.Simple1, + Simple1, /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - proto.jspb.test.Simple1.toObject), + Simple1.toObject), 0); -proto.jspb.test.HasExtensions.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.IndirectExtension.simple, +HasExtensions.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + IndirectExtension.simple, jspb.BinaryReader.prototype.readMessage, jspb.BinaryWriter.prototype.writeMessage, - proto.jspb.test.Simple1.serializeBinaryToWriter, - proto.jspb.test.Simple1.deserializeBinaryFromReader, + Simple1.serializeBinaryToWriter, + Simple1.deserializeBinaryFromReader, false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.HasExtensions.extensions[101] = proto.jspb.test.IndirectExtension.simple; +HasExtensions.extensions[101] = IndirectExtension.simple; /** @@ -4117,7 +4070,7 @@ proto.jspb.test.HasExtensions.extensions[101] = proto.jspb.test.IndirectExtensio * field named `str`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.IndirectExtension.str = new jspb.ExtensionFieldInfo( +IndirectExtension.str = new jspb.ExtensionFieldInfo( 102, {str: 0}, null, @@ -4125,8 +4078,8 @@ proto.jspb.test.IndirectExtension.str = new jspb.ExtensionFieldInfo( null), 0); -proto.jspb.test.HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.IndirectExtension.str, +HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( + IndirectExtension.str, jspb.BinaryReader.prototype.readString, jspb.BinaryWriter.prototype.writeString, undefined, @@ -4134,7 +4087,7 @@ proto.jspb.test.HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBin false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.HasExtensions.extensions[102] = proto.jspb.test.IndirectExtension.str; +HasExtensions.extensions[102] = IndirectExtension.str; /** @@ -4142,7 +4095,7 @@ proto.jspb.test.HasExtensions.extensions[102] = proto.jspb.test.IndirectExtensio * field named `repeatedStrList`. * @type {!jspb.ExtensionFieldInfo>} */ -proto.jspb.test.IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( +IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( 103, {repeatedStrList: 0}, null, @@ -4150,8 +4103,8 @@ proto.jspb.test.IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( null), 1); -proto.jspb.test.HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.IndirectExtension.repeatedStrList, +HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBinaryInfo( + IndirectExtension.repeatedStrList, jspb.BinaryReader.prototype.readString, jspb.BinaryWriter.prototype.writeRepeatedString, undefined, @@ -4159,7 +4112,7 @@ proto.jspb.test.HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBin false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.HasExtensions.extensions[103] = proto.jspb.test.IndirectExtension.repeatedStrList; +HasExtensions.extensions[103] = IndirectExtension.repeatedStrList; /** @@ -4167,24 +4120,24 @@ proto.jspb.test.HasExtensions.extensions[103] = proto.jspb.test.IndirectExtensio * field named `repeatedSimpleList`. * @type {!jspb.ExtensionFieldInfo>} */ -proto.jspb.test.IndirectExtension.repeatedSimpleList = new jspb.ExtensionFieldInfo( +IndirectExtension.repeatedSimpleList = new jspb.ExtensionFieldInfo( 104, {repeatedSimpleList: 0}, - proto.jspb.test.Simple1, + Simple1, /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - proto.jspb.test.Simple1.toObject), + Simple1.toObject), 1); -proto.jspb.test.HasExtensions.extensionsBinary[104] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.IndirectExtension.repeatedSimpleList, +HasExtensions.extensionsBinary[104] = new jspb.ExtensionFieldBinaryInfo( + IndirectExtension.repeatedSimpleList, jspb.BinaryReader.prototype.readMessage, jspb.BinaryWriter.prototype.writeRepeatedMessage, - proto.jspb.test.Simple1.serializeBinaryToWriter, - proto.jspb.test.Simple1.deserializeBinaryFromReader, + Simple1.serializeBinaryToWriter, + Simple1.deserializeBinaryFromReader, false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.HasExtensions.extensions[104] = proto.jspb.test.IndirectExtension.repeatedSimpleList; +HasExtensions.extensions[104] = IndirectExtension.repeatedSimpleList; @@ -4202,8 +4155,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.DefaultValues.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.DefaultValues.toObject(opt_includeInstance, this); +DefaultValues.prototype.toObject = function(opt_includeInstance) { + return DefaultValues.toObject(opt_includeInstance, this); }; @@ -4216,7 +4169,7 @@ proto.jspb.test.DefaultValues.prototype.toObject = function(opt_includeInstance) * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.DefaultValues.toObject = function(includeInstance, msg) { +DefaultValues.toObject = function(includeInstance, msg) { var f, obj = { stringField: jspb.Message.getFieldWithDefault(msg, 1, "default\x3c\x3e\x27\x22abc"), boolField: jspb.Message.getBooleanFieldWithDefault(msg, 2, true), @@ -4239,10 +4192,10 @@ bytesField: msg.getBytesField_asB64() * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.DefaultValues} */ -proto.jspb.test.DefaultValues.deserializeBinary = function(bytes) { +DefaultValues.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.DefaultValues; - return proto.jspb.test.DefaultValues.deserializeBinaryFromReader(msg, reader); + var msg = new DefaultValues; + return DefaultValues.deserializeBinaryFromReader(msg, reader); }; @@ -4253,7 +4206,7 @@ proto.jspb.test.DefaultValues.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.DefaultValues} */ -proto.jspb.test.DefaultValues.deserializeBinaryFromReader = function(msg, reader) { +DefaultValues.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4297,9 +4250,9 @@ proto.jspb.test.DefaultValues.deserializeBinaryFromReader = function(msg, reader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.DefaultValues.prototype.serializeBinary = function() { +DefaultValues.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.DefaultValues.serializeBinaryToWriter(this, writer); + DefaultValues.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4311,7 +4264,7 @@ proto.jspb.test.DefaultValues.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.DefaultValues.serializeBinaryToWriter = function(message, writer) { +DefaultValues.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -4361,7 +4314,7 @@ proto.jspb.test.DefaultValues.serializeBinaryToWriter = function(message, writer /** * @enum {number} */ -proto.jspb.test.DefaultValues.Enum = { +DefaultValues.Enum = { E1: 13, E2: 77 }; @@ -4370,7 +4323,7 @@ proto.jspb.test.DefaultValues.Enum = { * optional string string_field = 1; * @return {string} */ -proto.jspb.test.DefaultValues.prototype.getStringField = function() { +DefaultValues.prototype.getStringField = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "default\x3c\x3e\x27\x22abc")); }; @@ -4379,7 +4332,7 @@ proto.jspb.test.DefaultValues.prototype.getStringField = function() { * @param {string} value * @return {!proto.jspb.test.DefaultValues} returns this */ -proto.jspb.test.DefaultValues.prototype.setStringField = function(value) { +DefaultValues.prototype.setStringField = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -4388,7 +4341,7 @@ proto.jspb.test.DefaultValues.prototype.setStringField = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.DefaultValues} returns this */ -proto.jspb.test.DefaultValues.prototype.clearStringField = function() { +DefaultValues.prototype.clearStringField = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -4397,7 +4350,7 @@ proto.jspb.test.DefaultValues.prototype.clearStringField = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.DefaultValues.prototype.hasStringField = function() { +DefaultValues.prototype.hasStringField = function() { return jspb.Message.getField(this, 1) != null; }; @@ -4406,7 +4359,7 @@ proto.jspb.test.DefaultValues.prototype.hasStringField = function() { * optional bool bool_field = 2; * @return {boolean} */ -proto.jspb.test.DefaultValues.prototype.getBoolField = function() { +DefaultValues.prototype.getBoolField = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, true)); }; @@ -4415,7 +4368,7 @@ proto.jspb.test.DefaultValues.prototype.getBoolField = function() { * @param {boolean} value * @return {!proto.jspb.test.DefaultValues} returns this */ -proto.jspb.test.DefaultValues.prototype.setBoolField = function(value) { +DefaultValues.prototype.setBoolField = function(value) { return jspb.Message.setField(this, 2, value); }; @@ -4424,7 +4377,7 @@ proto.jspb.test.DefaultValues.prototype.setBoolField = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.DefaultValues} returns this */ -proto.jspb.test.DefaultValues.prototype.clearBoolField = function() { +DefaultValues.prototype.clearBoolField = function() { return jspb.Message.setField(this, 2, undefined); }; @@ -4433,7 +4386,7 @@ proto.jspb.test.DefaultValues.prototype.clearBoolField = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.DefaultValues.prototype.hasBoolField = function() { +DefaultValues.prototype.hasBoolField = function() { return jspb.Message.getField(this, 2) != null; }; @@ -4442,7 +4395,7 @@ proto.jspb.test.DefaultValues.prototype.hasBoolField = function() { * optional int64 int_field = 3; * @return {number} */ -proto.jspb.test.DefaultValues.prototype.getIntField = function() { +DefaultValues.prototype.getIntField = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 11)); }; @@ -4451,7 +4404,7 @@ proto.jspb.test.DefaultValues.prototype.getIntField = function() { * @param {number} value * @return {!proto.jspb.test.DefaultValues} returns this */ -proto.jspb.test.DefaultValues.prototype.setIntField = function(value) { +DefaultValues.prototype.setIntField = function(value) { return jspb.Message.setField(this, 3, value); }; @@ -4460,7 +4413,7 @@ proto.jspb.test.DefaultValues.prototype.setIntField = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.DefaultValues} returns this */ -proto.jspb.test.DefaultValues.prototype.clearIntField = function() { +DefaultValues.prototype.clearIntField = function() { return jspb.Message.setField(this, 3, undefined); }; @@ -4469,7 +4422,7 @@ proto.jspb.test.DefaultValues.prototype.clearIntField = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.DefaultValues.prototype.hasIntField = function() { +DefaultValues.prototype.hasIntField = function() { return jspb.Message.getField(this, 3) != null; }; @@ -4478,7 +4431,7 @@ proto.jspb.test.DefaultValues.prototype.hasIntField = function() { * optional Enum enum_field = 4; * @return {!proto.jspb.test.DefaultValues.Enum} */ -proto.jspb.test.DefaultValues.prototype.getEnumField = function() { +DefaultValues.prototype.getEnumField = function() { return /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getFieldWithDefault(this, 4, 13)); }; @@ -4487,7 +4440,7 @@ proto.jspb.test.DefaultValues.prototype.getEnumField = function() { * @param {!proto.jspb.test.DefaultValues.Enum} value * @return {!proto.jspb.test.DefaultValues} returns this */ -proto.jspb.test.DefaultValues.prototype.setEnumField = function(value) { +DefaultValues.prototype.setEnumField = function(value) { return jspb.Message.setField(this, 4, value); }; @@ -4496,7 +4449,7 @@ proto.jspb.test.DefaultValues.prototype.setEnumField = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.DefaultValues} returns this */ -proto.jspb.test.DefaultValues.prototype.clearEnumField = function() { +DefaultValues.prototype.clearEnumField = function() { return jspb.Message.setField(this, 4, undefined); }; @@ -4505,7 +4458,7 @@ proto.jspb.test.DefaultValues.prototype.clearEnumField = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.DefaultValues.prototype.hasEnumField = function() { +DefaultValues.prototype.hasEnumField = function() { return jspb.Message.getField(this, 4) != null; }; @@ -4514,7 +4467,7 @@ proto.jspb.test.DefaultValues.prototype.hasEnumField = function() { * optional string empty_field = 6; * @return {string} */ -proto.jspb.test.DefaultValues.prototype.getEmptyField = function() { +DefaultValues.prototype.getEmptyField = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); }; @@ -4523,7 +4476,7 @@ proto.jspb.test.DefaultValues.prototype.getEmptyField = function() { * @param {string} value * @return {!proto.jspb.test.DefaultValues} returns this */ -proto.jspb.test.DefaultValues.prototype.setEmptyField = function(value) { +DefaultValues.prototype.setEmptyField = function(value) { return jspb.Message.setField(this, 6, value); }; @@ -4532,7 +4485,7 @@ proto.jspb.test.DefaultValues.prototype.setEmptyField = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.DefaultValues} returns this */ -proto.jspb.test.DefaultValues.prototype.clearEmptyField = function() { +DefaultValues.prototype.clearEmptyField = function() { return jspb.Message.setField(this, 6, undefined); }; @@ -4541,7 +4494,7 @@ proto.jspb.test.DefaultValues.prototype.clearEmptyField = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.DefaultValues.prototype.hasEmptyField = function() { +DefaultValues.prototype.hasEmptyField = function() { return jspb.Message.getField(this, 6) != null; }; @@ -4550,7 +4503,7 @@ proto.jspb.test.DefaultValues.prototype.hasEmptyField = function() { * optional bytes bytes_field = 8; * @return {!(string|Uint8Array)} */ -proto.jspb.test.DefaultValues.prototype.getBytesField = function() { +DefaultValues.prototype.getBytesField = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 8, "bW9v")); }; @@ -4560,7 +4513,7 @@ proto.jspb.test.DefaultValues.prototype.getBytesField = function() { * This is a type-conversion wrapper around `getBytesField()` * @return {string} */ -proto.jspb.test.DefaultValues.prototype.getBytesField_asB64 = function() { +DefaultValues.prototype.getBytesField_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getBytesField())); }; @@ -4573,7 +4526,7 @@ proto.jspb.test.DefaultValues.prototype.getBytesField_asB64 = function() { * This is a type-conversion wrapper around `getBytesField()` * @return {!Uint8Array} */ -proto.jspb.test.DefaultValues.prototype.getBytesField_asU8 = function() { +DefaultValues.prototype.getBytesField_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getBytesField())); }; @@ -4583,7 +4536,7 @@ proto.jspb.test.DefaultValues.prototype.getBytesField_asU8 = function() { * @param {!(string|Uint8Array)} value * @return {!proto.jspb.test.DefaultValues} returns this */ -proto.jspb.test.DefaultValues.prototype.setBytesField = function(value) { +DefaultValues.prototype.setBytesField = function(value) { return jspb.Message.setField(this, 8, value); }; @@ -4592,7 +4545,7 @@ proto.jspb.test.DefaultValues.prototype.setBytesField = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.DefaultValues} returns this */ -proto.jspb.test.DefaultValues.prototype.clearBytesField = function() { +DefaultValues.prototype.clearBytesField = function() { return jspb.Message.setField(this, 8, undefined); }; @@ -4601,7 +4554,7 @@ proto.jspb.test.DefaultValues.prototype.clearBytesField = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.DefaultValues.prototype.hasBytesField = function() { +DefaultValues.prototype.hasBytesField = function() { return jspb.Message.getField(this, 8) != null; }; @@ -4612,7 +4565,7 @@ proto.jspb.test.DefaultValues.prototype.hasBytesField = function() { * @private {!Array} * @const */ -proto.jspb.test.FloatingPointFields.repeatedFields_ = [3,7]; +FloatingPointFields.repeatedFields_ = [3,7]; @@ -4629,8 +4582,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.FloatingPointFields.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.FloatingPointFields.toObject(opt_includeInstance, this); +FloatingPointFields.prototype.toObject = function(opt_includeInstance) { + return FloatingPointFields.toObject(opt_includeInstance, this); }; @@ -4643,7 +4596,7 @@ proto.jspb.test.FloatingPointFields.prototype.toObject = function(opt_includeIns * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.FloatingPointFields.toObject = function(includeInstance, msg) { +FloatingPointFields.toObject = function(includeInstance, msg) { var f, obj = { optionalFloatField: (f = jspb.Message.getOptionalFloatingPointField(msg, 1)) == null ? undefined : f, requiredFloatField: (f = jspb.Message.getOptionalFloatingPointField(msg, 2)) == null ? undefined : f, @@ -4668,10 +4621,10 @@ defaultDoubleField: jspb.Message.getFloatingPointFieldWithDefault(msg, 8, 2.0) * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.FloatingPointFields} */ -proto.jspb.test.FloatingPointFields.deserializeBinary = function(bytes) { +FloatingPointFields.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.FloatingPointFields; - return proto.jspb.test.FloatingPointFields.deserializeBinaryFromReader(msg, reader); + var msg = new FloatingPointFields; + return FloatingPointFields.deserializeBinaryFromReader(msg, reader); }; @@ -4682,7 +4635,7 @@ proto.jspb.test.FloatingPointFields.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.FloatingPointFields} */ -proto.jspb.test.FloatingPointFields.deserializeBinaryFromReader = function(msg, reader) { +FloatingPointFields.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -4738,9 +4691,9 @@ proto.jspb.test.FloatingPointFields.deserializeBinaryFromReader = function(msg, * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.FloatingPointFields.prototype.serializeBinary = function() { +FloatingPointFields.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.FloatingPointFields.serializeBinaryToWriter(this, writer); + FloatingPointFields.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -4752,7 +4705,7 @@ proto.jspb.test.FloatingPointFields.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.FloatingPointFields.serializeBinaryToWriter = function(message, writer) { +FloatingPointFields.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -4817,7 +4770,7 @@ proto.jspb.test.FloatingPointFields.serializeBinaryToWriter = function(message, * optional float optional_float_field = 1; * @return {number} */ -proto.jspb.test.FloatingPointFields.prototype.getOptionalFloatField = function() { +FloatingPointFields.prototype.getOptionalFloatField = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); }; @@ -4826,7 +4779,7 @@ proto.jspb.test.FloatingPointFields.prototype.getOptionalFloatField = function() * @param {number} value * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.setOptionalFloatField = function(value) { +FloatingPointFields.prototype.setOptionalFloatField = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -4835,7 +4788,7 @@ proto.jspb.test.FloatingPointFields.prototype.setOptionalFloatField = function(v * Clears the field making it undefined. * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.clearOptionalFloatField = function() { +FloatingPointFields.prototype.clearOptionalFloatField = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -4844,7 +4797,7 @@ proto.jspb.test.FloatingPointFields.prototype.clearOptionalFloatField = function * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.FloatingPointFields.prototype.hasOptionalFloatField = function() { +FloatingPointFields.prototype.hasOptionalFloatField = function() { return jspb.Message.getField(this, 1) != null; }; @@ -4853,7 +4806,7 @@ proto.jspb.test.FloatingPointFields.prototype.hasOptionalFloatField = function() * required float required_float_field = 2; * @return {number} */ -proto.jspb.test.FloatingPointFields.prototype.getRequiredFloatField = function() { +FloatingPointFields.prototype.getRequiredFloatField = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); }; @@ -4862,7 +4815,7 @@ proto.jspb.test.FloatingPointFields.prototype.getRequiredFloatField = function() * @param {number} value * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.setRequiredFloatField = function(value) { +FloatingPointFields.prototype.setRequiredFloatField = function(value) { return jspb.Message.setField(this, 2, value); }; @@ -4871,7 +4824,7 @@ proto.jspb.test.FloatingPointFields.prototype.setRequiredFloatField = function(v * Clears the field making it undefined. * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.clearRequiredFloatField = function() { +FloatingPointFields.prototype.clearRequiredFloatField = function() { return jspb.Message.setField(this, 2, undefined); }; @@ -4880,7 +4833,7 @@ proto.jspb.test.FloatingPointFields.prototype.clearRequiredFloatField = function * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.FloatingPointFields.prototype.hasRequiredFloatField = function() { +FloatingPointFields.prototype.hasRequiredFloatField = function() { return jspb.Message.getField(this, 2) != null; }; @@ -4889,7 +4842,7 @@ proto.jspb.test.FloatingPointFields.prototype.hasRequiredFloatField = function() * repeated float repeated_float_field = 3; * @return {!Array} */ -proto.jspb.test.FloatingPointFields.prototype.getRepeatedFloatFieldList = function() { +FloatingPointFields.prototype.getRepeatedFloatFieldList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 3)); }; @@ -4898,7 +4851,7 @@ proto.jspb.test.FloatingPointFields.prototype.getRepeatedFloatFieldList = functi * @param {!Array} value * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.setRepeatedFloatFieldList = function(value) { +FloatingPointFields.prototype.setRepeatedFloatFieldList = function(value) { return jspb.Message.setField(this, 3, value || []); }; @@ -4908,7 +4861,7 @@ proto.jspb.test.FloatingPointFields.prototype.setRepeatedFloatFieldList = functi * @param {number=} opt_index * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.addRepeatedFloatField = function(value, opt_index) { +FloatingPointFields.prototype.addRepeatedFloatField = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 3, value, opt_index); }; @@ -4917,7 +4870,7 @@ proto.jspb.test.FloatingPointFields.prototype.addRepeatedFloatField = function(v * Clears the list making it empty but non-null. * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.clearRepeatedFloatFieldList = function() { +FloatingPointFields.prototype.clearRepeatedFloatFieldList = function() { return this.setRepeatedFloatFieldList([]); }; @@ -4926,7 +4879,7 @@ proto.jspb.test.FloatingPointFields.prototype.clearRepeatedFloatFieldList = func * optional float default_float_field = 4; * @return {number} */ -proto.jspb.test.FloatingPointFields.prototype.getDefaultFloatField = function() { +FloatingPointFields.prototype.getDefaultFloatField = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 2.0)); }; @@ -4935,7 +4888,7 @@ proto.jspb.test.FloatingPointFields.prototype.getDefaultFloatField = function() * @param {number} value * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.setDefaultFloatField = function(value) { +FloatingPointFields.prototype.setDefaultFloatField = function(value) { return jspb.Message.setField(this, 4, value); }; @@ -4944,7 +4897,7 @@ proto.jspb.test.FloatingPointFields.prototype.setDefaultFloatField = function(va * Clears the field making it undefined. * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.clearDefaultFloatField = function() { +FloatingPointFields.prototype.clearDefaultFloatField = function() { return jspb.Message.setField(this, 4, undefined); }; @@ -4953,7 +4906,7 @@ proto.jspb.test.FloatingPointFields.prototype.clearDefaultFloatField = function( * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.FloatingPointFields.prototype.hasDefaultFloatField = function() { +FloatingPointFields.prototype.hasDefaultFloatField = function() { return jspb.Message.getField(this, 4) != null; }; @@ -4962,7 +4915,7 @@ proto.jspb.test.FloatingPointFields.prototype.hasDefaultFloatField = function() * optional double optional_double_field = 5; * @return {number} */ -proto.jspb.test.FloatingPointFields.prototype.getOptionalDoubleField = function() { +FloatingPointFields.prototype.getOptionalDoubleField = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); }; @@ -4971,7 +4924,7 @@ proto.jspb.test.FloatingPointFields.prototype.getOptionalDoubleField = function( * @param {number} value * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.setOptionalDoubleField = function(value) { +FloatingPointFields.prototype.setOptionalDoubleField = function(value) { return jspb.Message.setField(this, 5, value); }; @@ -4980,7 +4933,7 @@ proto.jspb.test.FloatingPointFields.prototype.setOptionalDoubleField = function( * Clears the field making it undefined. * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.clearOptionalDoubleField = function() { +FloatingPointFields.prototype.clearOptionalDoubleField = function() { return jspb.Message.setField(this, 5, undefined); }; @@ -4989,7 +4942,7 @@ proto.jspb.test.FloatingPointFields.prototype.clearOptionalDoubleField = functio * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.FloatingPointFields.prototype.hasOptionalDoubleField = function() { +FloatingPointFields.prototype.hasOptionalDoubleField = function() { return jspb.Message.getField(this, 5) != null; }; @@ -4998,7 +4951,7 @@ proto.jspb.test.FloatingPointFields.prototype.hasOptionalDoubleField = function( * required double required_double_field = 6; * @return {number} */ -proto.jspb.test.FloatingPointFields.prototype.getRequiredDoubleField = function() { +FloatingPointFields.prototype.getRequiredDoubleField = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 6, 0.0)); }; @@ -5007,7 +4960,7 @@ proto.jspb.test.FloatingPointFields.prototype.getRequiredDoubleField = function( * @param {number} value * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.setRequiredDoubleField = function(value) { +FloatingPointFields.prototype.setRequiredDoubleField = function(value) { return jspb.Message.setField(this, 6, value); }; @@ -5016,7 +4969,7 @@ proto.jspb.test.FloatingPointFields.prototype.setRequiredDoubleField = function( * Clears the field making it undefined. * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.clearRequiredDoubleField = function() { +FloatingPointFields.prototype.clearRequiredDoubleField = function() { return jspb.Message.setField(this, 6, undefined); }; @@ -5025,7 +4978,7 @@ proto.jspb.test.FloatingPointFields.prototype.clearRequiredDoubleField = functio * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.FloatingPointFields.prototype.hasRequiredDoubleField = function() { +FloatingPointFields.prototype.hasRequiredDoubleField = function() { return jspb.Message.getField(this, 6) != null; }; @@ -5034,7 +4987,7 @@ proto.jspb.test.FloatingPointFields.prototype.hasRequiredDoubleField = function( * repeated double repeated_double_field = 7; * @return {!Array} */ -proto.jspb.test.FloatingPointFields.prototype.getRepeatedDoubleFieldList = function() { +FloatingPointFields.prototype.getRepeatedDoubleFieldList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 7)); }; @@ -5043,7 +4996,7 @@ proto.jspb.test.FloatingPointFields.prototype.getRepeatedDoubleFieldList = funct * @param {!Array} value * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.setRepeatedDoubleFieldList = function(value) { +FloatingPointFields.prototype.setRepeatedDoubleFieldList = function(value) { return jspb.Message.setField(this, 7, value || []); }; @@ -5053,7 +5006,7 @@ proto.jspb.test.FloatingPointFields.prototype.setRepeatedDoubleFieldList = funct * @param {number=} opt_index * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.addRepeatedDoubleField = function(value, opt_index) { +FloatingPointFields.prototype.addRepeatedDoubleField = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 7, value, opt_index); }; @@ -5062,7 +5015,7 @@ proto.jspb.test.FloatingPointFields.prototype.addRepeatedDoubleField = function( * Clears the list making it empty but non-null. * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.clearRepeatedDoubleFieldList = function() { +FloatingPointFields.prototype.clearRepeatedDoubleFieldList = function() { return this.setRepeatedDoubleFieldList([]); }; @@ -5071,7 +5024,7 @@ proto.jspb.test.FloatingPointFields.prototype.clearRepeatedDoubleFieldList = fun * optional double default_double_field = 8; * @return {number} */ -proto.jspb.test.FloatingPointFields.prototype.getDefaultDoubleField = function() { +FloatingPointFields.prototype.getDefaultDoubleField = function() { return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 8, 2.0)); }; @@ -5080,7 +5033,7 @@ proto.jspb.test.FloatingPointFields.prototype.getDefaultDoubleField = function() * @param {number} value * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.setDefaultDoubleField = function(value) { +FloatingPointFields.prototype.setDefaultDoubleField = function(value) { return jspb.Message.setField(this, 8, value); }; @@ -5089,7 +5042,7 @@ proto.jspb.test.FloatingPointFields.prototype.setDefaultDoubleField = function(v * Clears the field making it undefined. * @return {!proto.jspb.test.FloatingPointFields} returns this */ -proto.jspb.test.FloatingPointFields.prototype.clearDefaultDoubleField = function() { +FloatingPointFields.prototype.clearDefaultDoubleField = function() { return jspb.Message.setField(this, 8, undefined); }; @@ -5098,7 +5051,7 @@ proto.jspb.test.FloatingPointFields.prototype.clearDefaultDoubleField = function * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.FloatingPointFields.prototype.hasDefaultDoubleField = function() { +FloatingPointFields.prototype.hasDefaultDoubleField = function() { return jspb.Message.getField(this, 8) != null; }; @@ -5109,7 +5062,7 @@ proto.jspb.test.FloatingPointFields.prototype.hasDefaultDoubleField = function() * @private {!Array} * @const */ -proto.jspb.test.BooleanFields.repeatedFields_ = [3]; +BooleanFields.repeatedFields_ = [3]; @@ -5126,8 +5079,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.BooleanFields.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.BooleanFields.toObject(opt_includeInstance, this); +BooleanFields.prototype.toObject = function(opt_includeInstance) { + return BooleanFields.toObject(opt_includeInstance, this); }; @@ -5140,7 +5093,7 @@ proto.jspb.test.BooleanFields.prototype.toObject = function(opt_includeInstance) * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.BooleanFields.toObject = function(includeInstance, msg) { +BooleanFields.toObject = function(includeInstance, msg) { var f, obj = { optionalBooleanField: (f = jspb.Message.getBooleanField(msg, 1)) == null ? undefined : f, requiredBooleanField: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, @@ -5161,10 +5114,10 @@ defaultBooleanField: jspb.Message.getBooleanFieldWithDefault(msg, 4, true) * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.BooleanFields} */ -proto.jspb.test.BooleanFields.deserializeBinary = function(bytes) { +BooleanFields.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.BooleanFields; - return proto.jspb.test.BooleanFields.deserializeBinaryFromReader(msg, reader); + var msg = new BooleanFields; + return BooleanFields.deserializeBinaryFromReader(msg, reader); }; @@ -5175,7 +5128,7 @@ proto.jspb.test.BooleanFields.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.BooleanFields} */ -proto.jspb.test.BooleanFields.deserializeBinaryFromReader = function(msg, reader) { +BooleanFields.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5213,9 +5166,9 @@ proto.jspb.test.BooleanFields.deserializeBinaryFromReader = function(msg, reader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.BooleanFields.prototype.serializeBinary = function() { +BooleanFields.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.BooleanFields.serializeBinaryToWriter(this, writer); + BooleanFields.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5227,7 +5180,7 @@ proto.jspb.test.BooleanFields.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.BooleanFields.serializeBinaryToWriter = function(message, writer) { +BooleanFields.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {boolean} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -5264,7 +5217,7 @@ proto.jspb.test.BooleanFields.serializeBinaryToWriter = function(message, writer * optional bool optional_boolean_field = 1; * @return {boolean} */ -proto.jspb.test.BooleanFields.prototype.getOptionalBooleanField = function() { +BooleanFields.prototype.getOptionalBooleanField = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); }; @@ -5273,7 +5226,7 @@ proto.jspb.test.BooleanFields.prototype.getOptionalBooleanField = function() { * @param {boolean} value * @return {!proto.jspb.test.BooleanFields} returns this */ -proto.jspb.test.BooleanFields.prototype.setOptionalBooleanField = function(value) { +BooleanFields.prototype.setOptionalBooleanField = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -5282,7 +5235,7 @@ proto.jspb.test.BooleanFields.prototype.setOptionalBooleanField = function(value * Clears the field making it undefined. * @return {!proto.jspb.test.BooleanFields} returns this */ -proto.jspb.test.BooleanFields.prototype.clearOptionalBooleanField = function() { +BooleanFields.prototype.clearOptionalBooleanField = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -5291,7 +5244,7 @@ proto.jspb.test.BooleanFields.prototype.clearOptionalBooleanField = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.BooleanFields.prototype.hasOptionalBooleanField = function() { +BooleanFields.prototype.hasOptionalBooleanField = function() { return jspb.Message.getField(this, 1) != null; }; @@ -5300,7 +5253,7 @@ proto.jspb.test.BooleanFields.prototype.hasOptionalBooleanField = function() { * required bool required_boolean_field = 2; * @return {boolean} */ -proto.jspb.test.BooleanFields.prototype.getRequiredBooleanField = function() { +BooleanFields.prototype.getRequiredBooleanField = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); }; @@ -5309,7 +5262,7 @@ proto.jspb.test.BooleanFields.prototype.getRequiredBooleanField = function() { * @param {boolean} value * @return {!proto.jspb.test.BooleanFields} returns this */ -proto.jspb.test.BooleanFields.prototype.setRequiredBooleanField = function(value) { +BooleanFields.prototype.setRequiredBooleanField = function(value) { return jspb.Message.setField(this, 2, value); }; @@ -5318,7 +5271,7 @@ proto.jspb.test.BooleanFields.prototype.setRequiredBooleanField = function(value * Clears the field making it undefined. * @return {!proto.jspb.test.BooleanFields} returns this */ -proto.jspb.test.BooleanFields.prototype.clearRequiredBooleanField = function() { +BooleanFields.prototype.clearRequiredBooleanField = function() { return jspb.Message.setField(this, 2, undefined); }; @@ -5327,7 +5280,7 @@ proto.jspb.test.BooleanFields.prototype.clearRequiredBooleanField = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.BooleanFields.prototype.hasRequiredBooleanField = function() { +BooleanFields.prototype.hasRequiredBooleanField = function() { return jspb.Message.getField(this, 2) != null; }; @@ -5336,7 +5289,7 @@ proto.jspb.test.BooleanFields.prototype.hasRequiredBooleanField = function() { * repeated bool repeated_boolean_field = 3; * @return {!Array} */ -proto.jspb.test.BooleanFields.prototype.getRepeatedBooleanFieldList = function() { +BooleanFields.prototype.getRepeatedBooleanFieldList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 3)); }; @@ -5345,7 +5298,7 @@ proto.jspb.test.BooleanFields.prototype.getRepeatedBooleanFieldList = function() * @param {!Array} value * @return {!proto.jspb.test.BooleanFields} returns this */ -proto.jspb.test.BooleanFields.prototype.setRepeatedBooleanFieldList = function(value) { +BooleanFields.prototype.setRepeatedBooleanFieldList = function(value) { return jspb.Message.setField(this, 3, value || []); }; @@ -5355,7 +5308,7 @@ proto.jspb.test.BooleanFields.prototype.setRepeatedBooleanFieldList = function(v * @param {number=} opt_index * @return {!proto.jspb.test.BooleanFields} returns this */ -proto.jspb.test.BooleanFields.prototype.addRepeatedBooleanField = function(value, opt_index) { +BooleanFields.prototype.addRepeatedBooleanField = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 3, value, opt_index); }; @@ -5364,7 +5317,7 @@ proto.jspb.test.BooleanFields.prototype.addRepeatedBooleanField = function(value * Clears the list making it empty but non-null. * @return {!proto.jspb.test.BooleanFields} returns this */ -proto.jspb.test.BooleanFields.prototype.clearRepeatedBooleanFieldList = function() { +BooleanFields.prototype.clearRepeatedBooleanFieldList = function() { return this.setRepeatedBooleanFieldList([]); }; @@ -5373,7 +5326,7 @@ proto.jspb.test.BooleanFields.prototype.clearRepeatedBooleanFieldList = function * optional bool default_boolean_field = 4; * @return {boolean} */ -proto.jspb.test.BooleanFields.prototype.getDefaultBooleanField = function() { +BooleanFields.prototype.getDefaultBooleanField = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, true)); }; @@ -5382,7 +5335,7 @@ proto.jspb.test.BooleanFields.prototype.getDefaultBooleanField = function() { * @param {boolean} value * @return {!proto.jspb.test.BooleanFields} returns this */ -proto.jspb.test.BooleanFields.prototype.setDefaultBooleanField = function(value) { +BooleanFields.prototype.setDefaultBooleanField = function(value) { return jspb.Message.setField(this, 4, value); }; @@ -5391,7 +5344,7 @@ proto.jspb.test.BooleanFields.prototype.setDefaultBooleanField = function(value) * Clears the field making it undefined. * @return {!proto.jspb.test.BooleanFields} returns this */ -proto.jspb.test.BooleanFields.prototype.clearDefaultBooleanField = function() { +BooleanFields.prototype.clearDefaultBooleanField = function() { return jspb.Message.setField(this, 4, undefined); }; @@ -5400,7 +5353,7 @@ proto.jspb.test.BooleanFields.prototype.clearDefaultBooleanField = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.BooleanFields.prototype.hasDefaultBooleanField = function() { +BooleanFields.prototype.hasDefaultBooleanField = function() { return jspb.Message.getField(this, 4) != null; }; @@ -5411,7 +5364,7 @@ proto.jspb.test.BooleanFields.prototype.hasDefaultBooleanField = function() { * @private {!Array} * @const */ -proto.jspb.test.TestClone.repeatedFields_ = [5]; +TestClone.repeatedFields_ = [5]; @@ -5428,8 +5381,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestClone.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestClone.toObject(opt_includeInstance, this); +TestClone.prototype.toObject = function(opt_includeInstance) { + return TestClone.toObject(opt_includeInstance, this); }; @@ -5442,18 +5395,18 @@ proto.jspb.test.TestClone.prototype.toObject = function(opt_includeInstance) { * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestClone.toObject = function(includeInstance, msg) { +TestClone.toObject = function(includeInstance, msg) { var f, obj = { str: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, -simple1: (f = msg.getSimple1()) && proto.jspb.test.Simple1.toObject(includeInstance, f), +simple1: (f = msg.getSimple1()) && Simple1.toObject(includeInstance, f), simple2List: jspb.Message.toObjectList(msg.getSimple2List(), - proto.jspb.test.Simple1.toObject, includeInstance), + Simple1.toObject, includeInstance), bytesField: msg.getBytesField_asB64(), unused: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f }; jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, - proto.jspb.test.TestClone.extensions, proto.jspb.test.TestClone.prototype.getExtension, + TestClone.extensions, TestClone.prototype.getExtension, includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; @@ -5468,10 +5421,10 @@ unused: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestClone} */ -proto.jspb.test.TestClone.deserializeBinary = function(bytes) { +TestClone.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestClone; - return proto.jspb.test.TestClone.deserializeBinaryFromReader(msg, reader); + var msg = new TestClone; + return TestClone.deserializeBinaryFromReader(msg, reader); }; @@ -5482,7 +5435,7 @@ proto.jspb.test.TestClone.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestClone} */ -proto.jspb.test.TestClone.deserializeBinaryFromReader = function(msg, reader) { +TestClone.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5494,13 +5447,13 @@ proto.jspb.test.TestClone.deserializeBinaryFromReader = function(msg, reader) { msg.setStr(value); break; case 3: - var value = new proto.jspb.test.Simple1; - reader.readMessage(value,proto.jspb.test.Simple1.deserializeBinaryFromReader); + var value = new Simple1; + reader.readMessage(value,Simple1.deserializeBinaryFromReader); msg.setSimple1(value); break; case 5: - var value = new proto.jspb.test.Simple1; - reader.readMessage(value,proto.jspb.test.Simple1.deserializeBinaryFromReader); + var value = new Simple1; + reader.readMessage(value,Simple1.deserializeBinaryFromReader); msg.addSimple2(value); break; case 6: @@ -5513,9 +5466,9 @@ proto.jspb.test.TestClone.deserializeBinaryFromReader = function(msg, reader) { break; default: jspb.Message.readBinaryExtension(msg, reader, - proto.jspb.test.TestClone.extensionsBinary, - proto.jspb.test.TestClone.prototype.getExtension, - proto.jspb.test.TestClone.prototype.setExtension); + TestClone.extensionsBinary, + TestClone.prototype.getExtension, + TestClone.prototype.setExtension); break; } } @@ -5527,9 +5480,9 @@ proto.jspb.test.TestClone.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestClone.prototype.serializeBinary = function() { +TestClone.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestClone.serializeBinaryToWriter(this, writer); + TestClone.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5541,7 +5494,7 @@ proto.jspb.test.TestClone.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestClone.serializeBinaryToWriter = function(message, writer) { +TestClone.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -5555,7 +5508,7 @@ proto.jspb.test.TestClone.serializeBinaryToWriter = function(message, writer) { writer.writeMessage( 3, f, - proto.jspb.test.Simple1.serializeBinaryToWriter + Simple1.serializeBinaryToWriter ); } f = message.getSimple2List(); @@ -5563,7 +5516,7 @@ proto.jspb.test.TestClone.serializeBinaryToWriter = function(message, writer) { writer.writeRepeatedMessage( 5, f, - proto.jspb.test.Simple1.serializeBinaryToWriter + Simple1.serializeBinaryToWriter ); } f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 6)); @@ -5581,7 +5534,7 @@ proto.jspb.test.TestClone.serializeBinaryToWriter = function(message, writer) { ); } jspb.Message.serializeBinaryExtensions(message, writer, - proto.jspb.test.TestClone.extensionsBinary, proto.jspb.test.TestClone.prototype.getExtension); + TestClone.extensionsBinary, TestClone.prototype.getExtension); }; @@ -5589,7 +5542,7 @@ proto.jspb.test.TestClone.serializeBinaryToWriter = function(message, writer) { * optional string str = 1; * @return {string} */ -proto.jspb.test.TestClone.prototype.getStr = function() { +TestClone.prototype.getStr = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; @@ -5598,7 +5551,7 @@ proto.jspb.test.TestClone.prototype.getStr = function() { * @param {string} value * @return {!proto.jspb.test.TestClone} returns this */ -proto.jspb.test.TestClone.prototype.setStr = function(value) { +TestClone.prototype.setStr = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -5607,7 +5560,7 @@ proto.jspb.test.TestClone.prototype.setStr = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestClone} returns this */ -proto.jspb.test.TestClone.prototype.clearStr = function() { +TestClone.prototype.clearStr = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -5616,7 +5569,7 @@ proto.jspb.test.TestClone.prototype.clearStr = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestClone.prototype.hasStr = function() { +TestClone.prototype.hasStr = function() { return jspb.Message.getField(this, 1) != null; }; @@ -5625,9 +5578,9 @@ proto.jspb.test.TestClone.prototype.hasStr = function() { * optional Simple1 simple1 = 3; * @return {?proto.jspb.test.Simple1} */ -proto.jspb.test.TestClone.prototype.getSimple1 = function() { +TestClone.prototype.getSimple1 = function() { return /** @type{?proto.jspb.test.Simple1} */ ( - jspb.Message.getWrapperField(this, proto.jspb.test.Simple1, 3)); + jspb.Message.getWrapperField(this, Simple1, 3)); }; @@ -5635,7 +5588,7 @@ proto.jspb.test.TestClone.prototype.getSimple1 = function() { * @param {?proto.jspb.test.Simple1|undefined} value * @return {!proto.jspb.test.TestClone} returns this */ -proto.jspb.test.TestClone.prototype.setSimple1 = function(value) { +TestClone.prototype.setSimple1 = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; @@ -5644,7 +5597,7 @@ proto.jspb.test.TestClone.prototype.setSimple1 = function(value) { * Clears the message field making it undefined. * @return {!proto.jspb.test.TestClone} returns this */ -proto.jspb.test.TestClone.prototype.clearSimple1 = function() { +TestClone.prototype.clearSimple1 = function() { return this.setSimple1(undefined); }; @@ -5653,7 +5606,7 @@ proto.jspb.test.TestClone.prototype.clearSimple1 = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestClone.prototype.hasSimple1 = function() { +TestClone.prototype.hasSimple1 = function() { return jspb.Message.getField(this, 3) != null; }; @@ -5662,9 +5615,9 @@ proto.jspb.test.TestClone.prototype.hasSimple1 = function() { * repeated Simple1 simple2 = 5; * @return {!Array} */ -proto.jspb.test.TestClone.prototype.getSimple2List = function() { +TestClone.prototype.getSimple2List = function() { return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.Simple1, 5)); + jspb.Message.getRepeatedWrapperField(this, Simple1, 5)); }; @@ -5672,7 +5625,7 @@ proto.jspb.test.TestClone.prototype.getSimple2List = function() { * @param {!Array} value * @return {!proto.jspb.test.TestClone} returns this */ -proto.jspb.test.TestClone.prototype.setSimple2List = function(value) { +TestClone.prototype.setSimple2List = function(value) { return jspb.Message.setRepeatedWrapperField(this, 5, value); }; @@ -5682,8 +5635,8 @@ proto.jspb.test.TestClone.prototype.setSimple2List = function(value) { * @param {number=} opt_index * @return {!proto.jspb.test.Simple1} */ -proto.jspb.test.TestClone.prototype.addSimple2 = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.jspb.test.Simple1, opt_index); +TestClone.prototype.addSimple2 = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, Simple1, opt_index); }; @@ -5691,7 +5644,7 @@ proto.jspb.test.TestClone.prototype.addSimple2 = function(opt_value, opt_index) * Clears the list making it empty but non-null. * @return {!proto.jspb.test.TestClone} returns this */ -proto.jspb.test.TestClone.prototype.clearSimple2List = function() { +TestClone.prototype.clearSimple2List = function() { return this.setSimple2List([]); }; @@ -5700,7 +5653,7 @@ proto.jspb.test.TestClone.prototype.clearSimple2List = function() { * optional bytes bytes_field = 6; * @return {!(string|Uint8Array)} */ -proto.jspb.test.TestClone.prototype.getBytesField = function() { +TestClone.prototype.getBytesField = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 6, "")); }; @@ -5710,7 +5663,7 @@ proto.jspb.test.TestClone.prototype.getBytesField = function() { * This is a type-conversion wrapper around `getBytesField()` * @return {string} */ -proto.jspb.test.TestClone.prototype.getBytesField_asB64 = function() { +TestClone.prototype.getBytesField_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getBytesField())); }; @@ -5723,7 +5676,7 @@ proto.jspb.test.TestClone.prototype.getBytesField_asB64 = function() { * This is a type-conversion wrapper around `getBytesField()` * @return {!Uint8Array} */ -proto.jspb.test.TestClone.prototype.getBytesField_asU8 = function() { +TestClone.prototype.getBytesField_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getBytesField())); }; @@ -5733,7 +5686,7 @@ proto.jspb.test.TestClone.prototype.getBytesField_asU8 = function() { * @param {!(string|Uint8Array)} value * @return {!proto.jspb.test.TestClone} returns this */ -proto.jspb.test.TestClone.prototype.setBytesField = function(value) { +TestClone.prototype.setBytesField = function(value) { return jspb.Message.setField(this, 6, value); }; @@ -5742,7 +5695,7 @@ proto.jspb.test.TestClone.prototype.setBytesField = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestClone} returns this */ -proto.jspb.test.TestClone.prototype.clearBytesField = function() { +TestClone.prototype.clearBytesField = function() { return jspb.Message.setField(this, 6, undefined); }; @@ -5751,7 +5704,7 @@ proto.jspb.test.TestClone.prototype.clearBytesField = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestClone.prototype.hasBytesField = function() { +TestClone.prototype.hasBytesField = function() { return jspb.Message.getField(this, 6) != null; }; @@ -5760,7 +5713,7 @@ proto.jspb.test.TestClone.prototype.hasBytesField = function() { * optional string unused = 7; * @return {string} */ -proto.jspb.test.TestClone.prototype.getUnused = function() { +TestClone.prototype.getUnused = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); }; @@ -5769,7 +5722,7 @@ proto.jspb.test.TestClone.prototype.getUnused = function() { * @param {string} value * @return {!proto.jspb.test.TestClone} returns this */ -proto.jspb.test.TestClone.prototype.setUnused = function(value) { +TestClone.prototype.setUnused = function(value) { return jspb.Message.setField(this, 7, value); }; @@ -5778,7 +5731,7 @@ proto.jspb.test.TestClone.prototype.setUnused = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestClone} returns this */ -proto.jspb.test.TestClone.prototype.clearUnused = function() { +TestClone.prototype.clearUnused = function() { return jspb.Message.setField(this, 7, undefined); }; @@ -5787,7 +5740,7 @@ proto.jspb.test.TestClone.prototype.clearUnused = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestClone.prototype.hasUnused = function() { +TestClone.prototype.hasUnused = function() { return jspb.Message.getField(this, 7) != null; }; @@ -5808,8 +5761,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestCloneExtension.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestCloneExtension.toObject(opt_includeInstance, this); +TestCloneExtension.prototype.toObject = function(opt_includeInstance) { + return TestCloneExtension.toObject(opt_includeInstance, this); }; @@ -5822,7 +5775,7 @@ proto.jspb.test.TestCloneExtension.prototype.toObject = function(opt_includeInst * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestCloneExtension.toObject = function(includeInstance, msg) { +TestCloneExtension.toObject = function(includeInstance, msg) { var f, obj = { f: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; @@ -5840,10 +5793,10 @@ f: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestCloneExtension} */ -proto.jspb.test.TestCloneExtension.deserializeBinary = function(bytes) { +TestCloneExtension.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestCloneExtension; - return proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader(msg, reader); + var msg = new TestCloneExtension; + return TestCloneExtension.deserializeBinaryFromReader(msg, reader); }; @@ -5854,7 +5807,7 @@ proto.jspb.test.TestCloneExtension.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestCloneExtension} */ -proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader = function(msg, reader) { +TestCloneExtension.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -5878,9 +5831,9 @@ proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader = function(msg, r * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestCloneExtension.prototype.serializeBinary = function() { +TestCloneExtension.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestCloneExtension.serializeBinaryToWriter(this, writer); + TestCloneExtension.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -5892,7 +5845,7 @@ proto.jspb.test.TestCloneExtension.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestCloneExtension.serializeBinaryToWriter = function(message, writer) { +TestCloneExtension.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -5910,30 +5863,30 @@ proto.jspb.test.TestCloneExtension.serializeBinaryToWriter = function(message, w * field named `lowExt`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.TestCloneExtension.lowExt = new jspb.ExtensionFieldInfo( +TestCloneExtension.lowExt = new jspb.ExtensionFieldInfo( 11, {lowExt: 0}, - proto.jspb.test.TestCloneExtension, + TestCloneExtension, /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - proto.jspb.test.TestCloneExtension.toObject), + TestCloneExtension.toObject), 0); -proto.jspb.test.TestClone.extensionsBinary[11] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.TestCloneExtension.lowExt, +TestClone.extensionsBinary[11] = new jspb.ExtensionFieldBinaryInfo( + TestCloneExtension.lowExt, jspb.BinaryReader.prototype.readMessage, jspb.BinaryWriter.prototype.writeMessage, - proto.jspb.test.TestCloneExtension.serializeBinaryToWriter, - proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader, + TestCloneExtension.serializeBinaryToWriter, + TestCloneExtension.deserializeBinaryFromReader, false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.TestClone.extensions[11] = proto.jspb.test.TestCloneExtension.lowExt; +TestClone.extensions[11] = TestCloneExtension.lowExt; /** * optional int32 f = 1; * @return {number} */ -proto.jspb.test.TestCloneExtension.prototype.getF = function() { +TestCloneExtension.prototype.getF = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; @@ -5942,7 +5895,7 @@ proto.jspb.test.TestCloneExtension.prototype.getF = function() { * @param {number} value * @return {!proto.jspb.test.TestCloneExtension} returns this */ -proto.jspb.test.TestCloneExtension.prototype.setF = function(value) { +TestCloneExtension.prototype.setF = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -5951,7 +5904,7 @@ proto.jspb.test.TestCloneExtension.prototype.setF = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestCloneExtension} returns this */ -proto.jspb.test.TestCloneExtension.prototype.clearF = function() { +TestCloneExtension.prototype.clearF = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -5960,7 +5913,7 @@ proto.jspb.test.TestCloneExtension.prototype.clearF = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestCloneExtension.prototype.hasF = function() { +TestCloneExtension.prototype.hasF = function() { return jspb.Message.getField(this, 1) != null; }; @@ -5971,24 +5924,24 @@ proto.jspb.test.TestCloneExtension.prototype.hasF = function() { * field named `lowExt`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.TestCloneExtension.lowExt = new jspb.ExtensionFieldInfo( +TestCloneExtension.lowExt = new jspb.ExtensionFieldInfo( 11, {lowExt: 0}, - proto.jspb.test.TestCloneExtension, + TestCloneExtension, /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - proto.jspb.test.TestCloneExtension.toObject), + TestCloneExtension.toObject), 0); -proto.jspb.test.TestClone.extensionsBinary[11] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.TestCloneExtension.lowExt, +TestClone.extensionsBinary[11] = new jspb.ExtensionFieldBinaryInfo( + TestCloneExtension.lowExt, jspb.BinaryReader.prototype.readMessage, jspb.BinaryWriter.prototype.writeMessage, - proto.jspb.test.TestCloneExtension.serializeBinaryToWriter, - proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader, + TestCloneExtension.serializeBinaryToWriter, + TestCloneExtension.deserializeBinaryFromReader, false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.TestClone.extensions[11] = proto.jspb.test.TestCloneExtension.lowExt; +TestClone.extensions[11] = TestCloneExtension.lowExt; @@ -6006,8 +5959,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.CloneExtension.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.CloneExtension.toObject(opt_includeInstance, this); +CloneExtension.prototype.toObject = function(opt_includeInstance) { + return CloneExtension.toObject(opt_includeInstance, this); }; @@ -6020,7 +5973,7 @@ proto.jspb.test.CloneExtension.prototype.toObject = function(opt_includeInstance * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.CloneExtension.toObject = function(includeInstance, msg) { +CloneExtension.toObject = function(includeInstance, msg) { var f, obj = { ext: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f }; @@ -6038,10 +5991,10 @@ ext: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.CloneExtension} */ -proto.jspb.test.CloneExtension.deserializeBinary = function(bytes) { +CloneExtension.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.CloneExtension; - return proto.jspb.test.CloneExtension.deserializeBinaryFromReader(msg, reader); + var msg = new CloneExtension; + return CloneExtension.deserializeBinaryFromReader(msg, reader); }; @@ -6052,7 +6005,7 @@ proto.jspb.test.CloneExtension.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.CloneExtension} */ -proto.jspb.test.CloneExtension.deserializeBinaryFromReader = function(msg, reader) { +CloneExtension.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6076,9 +6029,9 @@ proto.jspb.test.CloneExtension.deserializeBinaryFromReader = function(msg, reade * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.CloneExtension.prototype.serializeBinary = function() { +CloneExtension.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.CloneExtension.serializeBinaryToWriter(this, writer); + CloneExtension.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6090,7 +6043,7 @@ proto.jspb.test.CloneExtension.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.CloneExtension.serializeBinaryToWriter = function(message, writer) { +CloneExtension.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 2)); if (f != null) { @@ -6108,30 +6061,30 @@ proto.jspb.test.CloneExtension.serializeBinaryToWriter = function(message, write * field named `extField`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.CloneExtension.extField = new jspb.ExtensionFieldInfo( +CloneExtension.extField = new jspb.ExtensionFieldInfo( 100, {extField: 0}, - proto.jspb.test.CloneExtension, + CloneExtension, /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - proto.jspb.test.CloneExtension.toObject), + CloneExtension.toObject), 0); -proto.jspb.test.TestClone.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.CloneExtension.extField, +TestClone.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + CloneExtension.extField, jspb.BinaryReader.prototype.readMessage, jspb.BinaryWriter.prototype.writeMessage, - proto.jspb.test.CloneExtension.serializeBinaryToWriter, - proto.jspb.test.CloneExtension.deserializeBinaryFromReader, + CloneExtension.serializeBinaryToWriter, + CloneExtension.deserializeBinaryFromReader, false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.TestClone.extensions[100] = proto.jspb.test.CloneExtension.extField; +TestClone.extensions[100] = CloneExtension.extField; /** * optional string ext = 2; * @return {string} */ -proto.jspb.test.CloneExtension.prototype.getExt = function() { +CloneExtension.prototype.getExt = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; @@ -6140,7 +6093,7 @@ proto.jspb.test.CloneExtension.prototype.getExt = function() { * @param {string} value * @return {!proto.jspb.test.CloneExtension} returns this */ -proto.jspb.test.CloneExtension.prototype.setExt = function(value) { +CloneExtension.prototype.setExt = function(value) { return jspb.Message.setField(this, 2, value); }; @@ -6149,7 +6102,7 @@ proto.jspb.test.CloneExtension.prototype.setExt = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.CloneExtension} returns this */ -proto.jspb.test.CloneExtension.prototype.clearExt = function() { +CloneExtension.prototype.clearExt = function() { return jspb.Message.setField(this, 2, undefined); }; @@ -6158,7 +6111,7 @@ proto.jspb.test.CloneExtension.prototype.clearExt = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.CloneExtension.prototype.hasExt = function() { +CloneExtension.prototype.hasExt = function() { return jspb.Message.getField(this, 2) != null; }; @@ -6169,24 +6122,24 @@ proto.jspb.test.CloneExtension.prototype.hasExt = function() { * field named `extField`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.CloneExtension.extField = new jspb.ExtensionFieldInfo( +CloneExtension.extField = new jspb.ExtensionFieldInfo( 100, {extField: 0}, - proto.jspb.test.CloneExtension, + CloneExtension, /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - proto.jspb.test.CloneExtension.toObject), + CloneExtension.toObject), 0); -proto.jspb.test.TestClone.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.CloneExtension.extField, +TestClone.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + CloneExtension.extField, jspb.BinaryReader.prototype.readMessage, jspb.BinaryWriter.prototype.writeMessage, - proto.jspb.test.CloneExtension.serializeBinaryToWriter, - proto.jspb.test.CloneExtension.deserializeBinaryFromReader, + CloneExtension.serializeBinaryToWriter, + CloneExtension.deserializeBinaryFromReader, false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.TestClone.extensions[100] = proto.jspb.test.CloneExtension.extField; +TestClone.extensions[100] = CloneExtension.extField; /** @@ -6194,7 +6147,7 @@ proto.jspb.test.TestClone.extensions[100] = proto.jspb.test.CloneExtension.extFi * @private {!Array} * @const */ -proto.jspb.test.TestGroup.repeatedFields_ = [1]; +TestGroup.repeatedFields_ = [1]; @@ -6211,8 +6164,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestGroup.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestGroup.toObject(opt_includeInstance, this); +TestGroup.prototype.toObject = function(opt_includeInstance) { + return TestGroup.toObject(opt_includeInstance, this); }; @@ -6225,15 +6178,15 @@ proto.jspb.test.TestGroup.prototype.toObject = function(opt_includeInstance) { * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestGroup.toObject = function(includeInstance, msg) { +TestGroup.toObject = function(includeInstance, msg) { var f, obj = { repeatedGroupList: jspb.Message.toObjectList(msg.getRepeatedGroupList(), - proto.jspb.test.TestGroup.RepeatedGroup.toObject, includeInstance), -requiredGroup: (f = msg.getRequiredGroup()) && proto.jspb.test.TestGroup.RequiredGroup.toObject(includeInstance, f), -optionalGroup: (f = msg.getOptionalGroup()) && proto.jspb.test.TestGroup.OptionalGroup.toObject(includeInstance, f), + TestGroup.RepeatedGroup.toObject, includeInstance), +requiredGroup: (f = msg.getRequiredGroup()) && TestGroup.RequiredGroup.toObject(includeInstance, f), +optionalGroup: (f = msg.getOptionalGroup()) && TestGroup.OptionalGroup.toObject(includeInstance, f), id: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f, -requiredSimple: (f = msg.getRequiredSimple()) && proto.jspb.test.Simple2.toObject(includeInstance, f), -optionalSimple: (f = msg.getOptionalSimple()) && proto.jspb.test.Simple2.toObject(includeInstance, f) +requiredSimple: (f = msg.getRequiredSimple()) && Simple2.toObject(includeInstance, f), +optionalSimple: (f = msg.getOptionalSimple()) && Simple2.toObject(includeInstance, f) }; if (includeInstance) { @@ -6249,10 +6202,10 @@ optionalSimple: (f = msg.getOptionalSimple()) && proto.jspb.test.Simple2.toObjec * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestGroup} */ -proto.jspb.test.TestGroup.deserializeBinary = function(bytes) { +TestGroup.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestGroup; - return proto.jspb.test.TestGroup.deserializeBinaryFromReader(msg, reader); + var msg = new TestGroup; + return TestGroup.deserializeBinaryFromReader(msg, reader); }; @@ -6263,7 +6216,7 @@ proto.jspb.test.TestGroup.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestGroup} */ -proto.jspb.test.TestGroup.deserializeBinaryFromReader = function(msg, reader) { +TestGroup.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6271,18 +6224,18 @@ proto.jspb.test.TestGroup.deserializeBinaryFromReader = function(msg, reader) { var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.jspb.test.TestGroup.RepeatedGroup; - reader.readGroup(1, value,proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader); + var value = new TestGroup.RepeatedGroup; + reader.readGroup(1, value,TestGroup.RepeatedGroup.deserializeBinaryFromReader); msg.addRepeatedGroup(value); break; case 2: - var value = new proto.jspb.test.TestGroup.RequiredGroup; - reader.readGroup(2, value,proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader); + var value = new TestGroup.RequiredGroup; + reader.readGroup(2, value,TestGroup.RequiredGroup.deserializeBinaryFromReader); msg.setRequiredGroup(value); break; case 3: - var value = new proto.jspb.test.TestGroup.OptionalGroup; - reader.readGroup(3, value,proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader); + var value = new TestGroup.OptionalGroup; + reader.readGroup(3, value,TestGroup.OptionalGroup.deserializeBinaryFromReader); msg.setOptionalGroup(value); break; case 4: @@ -6290,13 +6243,13 @@ proto.jspb.test.TestGroup.deserializeBinaryFromReader = function(msg, reader) { msg.setId(value); break; case 5: - var value = new proto.jspb.test.Simple2; - reader.readMessage(value,proto.jspb.test.Simple2.deserializeBinaryFromReader); + var value = new Simple2; + reader.readMessage(value,Simple2.deserializeBinaryFromReader); msg.setRequiredSimple(value); break; case 6: - var value = new proto.jspb.test.Simple2; - reader.readMessage(value,proto.jspb.test.Simple2.deserializeBinaryFromReader); + var value = new Simple2; + reader.readMessage(value,Simple2.deserializeBinaryFromReader); msg.setOptionalSimple(value); break; default: @@ -6312,9 +6265,9 @@ proto.jspb.test.TestGroup.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestGroup.prototype.serializeBinary = function() { +TestGroup.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestGroup.serializeBinaryToWriter(this, writer); + TestGroup.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6326,14 +6279,14 @@ proto.jspb.test.TestGroup.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestGroup.serializeBinaryToWriter = function(message, writer) { +TestGroup.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getRepeatedGroupList(); if (f.length > 0) { writer.writeRepeatedGroup( 1, f, - proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter + TestGroup.RepeatedGroup.serializeBinaryToWriter ); } f = message.getRequiredGroup(); @@ -6341,7 +6294,7 @@ proto.jspb.test.TestGroup.serializeBinaryToWriter = function(message, writer) { writer.writeGroup( 2, f, - proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter + TestGroup.RequiredGroup.serializeBinaryToWriter ); } f = message.getOptionalGroup(); @@ -6349,7 +6302,7 @@ proto.jspb.test.TestGroup.serializeBinaryToWriter = function(message, writer) { writer.writeGroup( 3, f, - proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter + TestGroup.OptionalGroup.serializeBinaryToWriter ); } f = /** @type {string} */ (jspb.Message.getField(message, 4)); @@ -6364,7 +6317,7 @@ proto.jspb.test.TestGroup.serializeBinaryToWriter = function(message, writer) { writer.writeMessage( 5, f, - proto.jspb.test.Simple2.serializeBinaryToWriter + Simple2.serializeBinaryToWriter ); } f = message.getOptionalSimple(); @@ -6372,7 +6325,7 @@ proto.jspb.test.TestGroup.serializeBinaryToWriter = function(message, writer) { writer.writeMessage( 6, f, - proto.jspb.test.Simple2.serializeBinaryToWriter + Simple2.serializeBinaryToWriter ); } }; @@ -6384,7 +6337,7 @@ proto.jspb.test.TestGroup.serializeBinaryToWriter = function(message, writer) { * @private {!Array} * @const */ -proto.jspb.test.TestGroup.RepeatedGroup.repeatedFields_ = [1]; +TestGroup.RepeatedGroup.repeatedFields_ = [1]; @@ -6401,8 +6354,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestGroup.RepeatedGroup.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestGroup.RepeatedGroup.toObject(opt_includeInstance, this); +TestGroup.RepeatedGroup.prototype.toObject = function(opt_includeInstance) { + return TestGroup.RepeatedGroup.toObject(opt_includeInstance, this); }; @@ -6415,7 +6368,7 @@ proto.jspb.test.TestGroup.RepeatedGroup.prototype.toObject = function(opt_includ * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestGroup.RepeatedGroup.toObject = function(includeInstance, msg) { +TestGroup.RepeatedGroup.toObject = function(includeInstance, msg) { var f, obj = { id: (f = jspb.Message.getField(msg, 0)) == null ? undefined : f, someBoolList: (f = jspb.Message.getRepeatedBooleanField(msg, 1)) == null ? undefined : f @@ -6434,10 +6387,10 @@ someBoolList: (f = jspb.Message.getRepeatedBooleanField(msg, 1)) == null ? undef * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestGroup.RepeatedGroup} */ -proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinary = function(bytes) { +TestGroup.RepeatedGroup.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestGroup.RepeatedGroup; - return proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader(msg, reader); + var msg = new TestGroup.RepeatedGroup; + return TestGroup.RepeatedGroup.deserializeBinaryFromReader(msg, reader); }; @@ -6448,7 +6401,7 @@ proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestGroup.RepeatedGroup} */ -proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader = function(msg, reader) { +TestGroup.RepeatedGroup.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6478,9 +6431,9 @@ proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader = function(m * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestGroup.RepeatedGroup.prototype.serializeBinary = function() { +TestGroup.RepeatedGroup.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter(this, writer); + TestGroup.RepeatedGroup.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6492,7 +6445,7 @@ proto.jspb.test.TestGroup.RepeatedGroup.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter = function(message, writer) { +TestGroup.RepeatedGroup.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 0)); if (f != null) { @@ -6515,7 +6468,7 @@ proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter = function(messa * required string id = 1; * @return {string} */ -proto.jspb.test.TestGroup.RepeatedGroup.prototype.getId = function() { +TestGroup.RepeatedGroup.prototype.getId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 0, "")); }; @@ -6524,7 +6477,7 @@ proto.jspb.test.TestGroup.RepeatedGroup.prototype.getId = function() { * @param {string} value * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this */ -proto.jspb.test.TestGroup.RepeatedGroup.prototype.setId = function(value) { +TestGroup.RepeatedGroup.prototype.setId = function(value) { return jspb.Message.setField(this, 0, value); }; @@ -6533,7 +6486,7 @@ proto.jspb.test.TestGroup.RepeatedGroup.prototype.setId = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this */ -proto.jspb.test.TestGroup.RepeatedGroup.prototype.clearId = function() { +TestGroup.RepeatedGroup.prototype.clearId = function() { return jspb.Message.setField(this, 0, undefined); }; @@ -6542,7 +6495,7 @@ proto.jspb.test.TestGroup.RepeatedGroup.prototype.clearId = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestGroup.RepeatedGroup.prototype.hasId = function() { +TestGroup.RepeatedGroup.prototype.hasId = function() { return jspb.Message.getField(this, 0) != null; }; @@ -6551,7 +6504,7 @@ proto.jspb.test.TestGroup.RepeatedGroup.prototype.hasId = function() { * repeated bool some_bool = 2; * @return {!Array} */ -proto.jspb.test.TestGroup.RepeatedGroup.prototype.getSomeBoolList = function() { +TestGroup.RepeatedGroup.prototype.getSomeBoolList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 1)); }; @@ -6560,7 +6513,7 @@ proto.jspb.test.TestGroup.RepeatedGroup.prototype.getSomeBoolList = function() { * @param {!Array} value * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this */ -proto.jspb.test.TestGroup.RepeatedGroup.prototype.setSomeBoolList = function(value) { +TestGroup.RepeatedGroup.prototype.setSomeBoolList = function(value) { return jspb.Message.setField(this, 1, value || []); }; @@ -6570,7 +6523,7 @@ proto.jspb.test.TestGroup.RepeatedGroup.prototype.setSomeBoolList = function(val * @param {number=} opt_index * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this */ -proto.jspb.test.TestGroup.RepeatedGroup.prototype.addSomeBool = function(value, opt_index) { +TestGroup.RepeatedGroup.prototype.addSomeBool = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 1, value, opt_index); }; @@ -6579,7 +6532,7 @@ proto.jspb.test.TestGroup.RepeatedGroup.prototype.addSomeBool = function(value, * Clears the list making it empty but non-null. * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this */ -proto.jspb.test.TestGroup.RepeatedGroup.prototype.clearSomeBoolList = function() { +TestGroup.RepeatedGroup.prototype.clearSomeBoolList = function() { return this.setSomeBoolList([]); }; @@ -6600,8 +6553,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestGroup.RequiredGroup.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestGroup.RequiredGroup.toObject(opt_includeInstance, this); +TestGroup.RequiredGroup.prototype.toObject = function(opt_includeInstance) { + return TestGroup.RequiredGroup.toObject(opt_includeInstance, this); }; @@ -6614,7 +6567,7 @@ proto.jspb.test.TestGroup.RequiredGroup.prototype.toObject = function(opt_includ * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestGroup.RequiredGroup.toObject = function(includeInstance, msg) { +TestGroup.RequiredGroup.toObject = function(includeInstance, msg) { var f, obj = { id: (f = jspb.Message.getField(msg, -1)) == null ? undefined : f }; @@ -6632,10 +6585,10 @@ id: (f = jspb.Message.getField(msg, -1)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestGroup.RequiredGroup} */ -proto.jspb.test.TestGroup.RequiredGroup.deserializeBinary = function(bytes) { +TestGroup.RequiredGroup.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestGroup.RequiredGroup; - return proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader(msg, reader); + var msg = new TestGroup.RequiredGroup; + return TestGroup.RequiredGroup.deserializeBinaryFromReader(msg, reader); }; @@ -6646,7 +6599,7 @@ proto.jspb.test.TestGroup.RequiredGroup.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestGroup.RequiredGroup} */ -proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader = function(msg, reader) { +TestGroup.RequiredGroup.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6670,9 +6623,9 @@ proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader = function(m * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestGroup.RequiredGroup.prototype.serializeBinary = function() { +TestGroup.RequiredGroup.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter(this, writer); + TestGroup.RequiredGroup.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6684,7 +6637,7 @@ proto.jspb.test.TestGroup.RequiredGroup.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter = function(message, writer) { +TestGroup.RequiredGroup.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, -1)); if (f != null) { @@ -6700,7 +6653,7 @@ proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter = function(messa * required string id = 1; * @return {string} */ -proto.jspb.test.TestGroup.RequiredGroup.prototype.getId = function() { +TestGroup.RequiredGroup.prototype.getId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, -1, "")); }; @@ -6709,7 +6662,7 @@ proto.jspb.test.TestGroup.RequiredGroup.prototype.getId = function() { * @param {string} value * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this */ -proto.jspb.test.TestGroup.RequiredGroup.prototype.setId = function(value) { +TestGroup.RequiredGroup.prototype.setId = function(value) { return jspb.Message.setField(this, -1, value); }; @@ -6718,7 +6671,7 @@ proto.jspb.test.TestGroup.RequiredGroup.prototype.setId = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this */ -proto.jspb.test.TestGroup.RequiredGroup.prototype.clearId = function() { +TestGroup.RequiredGroup.prototype.clearId = function() { return jspb.Message.setField(this, -1, undefined); }; @@ -6727,7 +6680,7 @@ proto.jspb.test.TestGroup.RequiredGroup.prototype.clearId = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestGroup.RequiredGroup.prototype.hasId = function() { +TestGroup.RequiredGroup.prototype.hasId = function() { return jspb.Message.getField(this, -1) != null; }; @@ -6748,8 +6701,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestGroup.OptionalGroup.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestGroup.OptionalGroup.toObject(opt_includeInstance, this); +TestGroup.OptionalGroup.prototype.toObject = function(opt_includeInstance) { + return TestGroup.OptionalGroup.toObject(opt_includeInstance, this); }; @@ -6762,7 +6715,7 @@ proto.jspb.test.TestGroup.OptionalGroup.prototype.toObject = function(opt_includ * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestGroup.OptionalGroup.toObject = function(includeInstance, msg) { +TestGroup.OptionalGroup.toObject = function(includeInstance, msg) { var f, obj = { id: (f = jspb.Message.getField(msg, -2)) == null ? undefined : f }; @@ -6780,10 +6733,10 @@ id: (f = jspb.Message.getField(msg, -2)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestGroup.OptionalGroup} */ -proto.jspb.test.TestGroup.OptionalGroup.deserializeBinary = function(bytes) { +TestGroup.OptionalGroup.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestGroup.OptionalGroup; - return proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader(msg, reader); + var msg = new TestGroup.OptionalGroup; + return TestGroup.OptionalGroup.deserializeBinaryFromReader(msg, reader); }; @@ -6794,7 +6747,7 @@ proto.jspb.test.TestGroup.OptionalGroup.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestGroup.OptionalGroup} */ -proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader = function(msg, reader) { +TestGroup.OptionalGroup.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -6818,9 +6771,9 @@ proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader = function(m * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestGroup.OptionalGroup.prototype.serializeBinary = function() { +TestGroup.OptionalGroup.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter(this, writer); + TestGroup.OptionalGroup.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -6832,7 +6785,7 @@ proto.jspb.test.TestGroup.OptionalGroup.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter = function(message, writer) { +TestGroup.OptionalGroup.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, -2)); if (f != null) { @@ -6848,7 +6801,7 @@ proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter = function(messa * required string id = 1; * @return {string} */ -proto.jspb.test.TestGroup.OptionalGroup.prototype.getId = function() { +TestGroup.OptionalGroup.prototype.getId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, -2, "")); }; @@ -6857,7 +6810,7 @@ proto.jspb.test.TestGroup.OptionalGroup.prototype.getId = function() { * @param {string} value * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this */ -proto.jspb.test.TestGroup.OptionalGroup.prototype.setId = function(value) { +TestGroup.OptionalGroup.prototype.setId = function(value) { return jspb.Message.setField(this, -2, value); }; @@ -6866,7 +6819,7 @@ proto.jspb.test.TestGroup.OptionalGroup.prototype.setId = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this */ -proto.jspb.test.TestGroup.OptionalGroup.prototype.clearId = function() { +TestGroup.OptionalGroup.prototype.clearId = function() { return jspb.Message.setField(this, -2, undefined); }; @@ -6875,7 +6828,7 @@ proto.jspb.test.TestGroup.OptionalGroup.prototype.clearId = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestGroup.OptionalGroup.prototype.hasId = function() { +TestGroup.OptionalGroup.prototype.hasId = function() { return jspb.Message.getField(this, -2) != null; }; @@ -6884,9 +6837,9 @@ proto.jspb.test.TestGroup.OptionalGroup.prototype.hasId = function() { * repeated group RepeatedGroup = 1; * @return {!Array} */ -proto.jspb.test.TestGroup.prototype.getRepeatedGroupList = function() { +TestGroup.prototype.getRepeatedGroupList = function() { return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.TestGroup.RepeatedGroup, 1)); + jspb.Message.getRepeatedWrapperField(this, TestGroup.RepeatedGroup, 1)); }; @@ -6894,7 +6847,7 @@ proto.jspb.test.TestGroup.prototype.getRepeatedGroupList = function() { * @param {!Array} value * @return {!proto.jspb.test.TestGroup} returns this */ -proto.jspb.test.TestGroup.prototype.setRepeatedGroupList = function(value) { +TestGroup.prototype.setRepeatedGroupList = function(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); }; @@ -6904,8 +6857,8 @@ proto.jspb.test.TestGroup.prototype.setRepeatedGroupList = function(value) { * @param {number=} opt_index * @return {!proto.jspb.test.TestGroup.RepeatedGroup} */ -proto.jspb.test.TestGroup.prototype.addRepeatedGroup = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.jspb.test.TestGroup.RepeatedGroup, opt_index); +TestGroup.prototype.addRepeatedGroup = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, TestGroup.RepeatedGroup, opt_index); }; @@ -6913,7 +6866,7 @@ proto.jspb.test.TestGroup.prototype.addRepeatedGroup = function(opt_value, opt_i * Clears the list making it empty but non-null. * @return {!proto.jspb.test.TestGroup} returns this */ -proto.jspb.test.TestGroup.prototype.clearRepeatedGroupList = function() { +TestGroup.prototype.clearRepeatedGroupList = function() { return this.setRepeatedGroupList([]); }; @@ -6922,9 +6875,9 @@ proto.jspb.test.TestGroup.prototype.clearRepeatedGroupList = function() { * required group RequiredGroup = 2; * @return {!proto.jspb.test.TestGroup.RequiredGroup} */ -proto.jspb.test.TestGroup.prototype.getRequiredGroup = function() { +TestGroup.prototype.getRequiredGroup = function() { return /** @type{!proto.jspb.test.TestGroup.RequiredGroup} */ ( - jspb.Message.getWrapperField(this, proto.jspb.test.TestGroup.RequiredGroup, 2, 1)); + jspb.Message.getWrapperField(this, TestGroup.RequiredGroup, 2, 1)); }; @@ -6932,7 +6885,7 @@ proto.jspb.test.TestGroup.prototype.getRequiredGroup = function() { * @param {!proto.jspb.test.TestGroup.RequiredGroup} value * @return {!proto.jspb.test.TestGroup} returns this */ -proto.jspb.test.TestGroup.prototype.setRequiredGroup = function(value) { +TestGroup.prototype.setRequiredGroup = function(value) { return jspb.Message.setWrapperField(this, 2, value); }; @@ -6941,7 +6894,7 @@ proto.jspb.test.TestGroup.prototype.setRequiredGroup = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestGroup} returns this */ -proto.jspb.test.TestGroup.prototype.clearRequiredGroup = function() { +TestGroup.prototype.clearRequiredGroup = function() { return jspb.Message.setField(this, 2, undefined); }; @@ -6950,7 +6903,7 @@ proto.jspb.test.TestGroup.prototype.clearRequiredGroup = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestGroup.prototype.hasRequiredGroup = function() { +TestGroup.prototype.hasRequiredGroup = function() { return jspb.Message.getField(this, 2) != null; }; @@ -6959,9 +6912,9 @@ proto.jspb.test.TestGroup.prototype.hasRequiredGroup = function() { * optional group OptionalGroup = 3; * @return {?proto.jspb.test.TestGroup.OptionalGroup} */ -proto.jspb.test.TestGroup.prototype.getOptionalGroup = function() { +TestGroup.prototype.getOptionalGroup = function() { return /** @type{?proto.jspb.test.TestGroup.OptionalGroup} */ ( - jspb.Message.getWrapperField(this, proto.jspb.test.TestGroup.OptionalGroup, 3)); + jspb.Message.getWrapperField(this, TestGroup.OptionalGroup, 3)); }; @@ -6969,7 +6922,7 @@ proto.jspb.test.TestGroup.prototype.getOptionalGroup = function() { * @param {?proto.jspb.test.TestGroup.OptionalGroup|undefined} value * @return {!proto.jspb.test.TestGroup} returns this */ -proto.jspb.test.TestGroup.prototype.setOptionalGroup = function(value) { +TestGroup.prototype.setOptionalGroup = function(value) { return jspb.Message.setWrapperField(this, 3, value); }; @@ -6978,7 +6931,7 @@ proto.jspb.test.TestGroup.prototype.setOptionalGroup = function(value) { * Clears the message field making it undefined. * @return {!proto.jspb.test.TestGroup} returns this */ -proto.jspb.test.TestGroup.prototype.clearOptionalGroup = function() { +TestGroup.prototype.clearOptionalGroup = function() { return this.setOptionalGroup(undefined); }; @@ -6987,7 +6940,7 @@ proto.jspb.test.TestGroup.prototype.clearOptionalGroup = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestGroup.prototype.hasOptionalGroup = function() { +TestGroup.prototype.hasOptionalGroup = function() { return jspb.Message.getField(this, 3) != null; }; @@ -6996,7 +6949,7 @@ proto.jspb.test.TestGroup.prototype.hasOptionalGroup = function() { * optional string id = 4; * @return {string} */ -proto.jspb.test.TestGroup.prototype.getId = function() { +TestGroup.prototype.getId = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); }; @@ -7005,7 +6958,7 @@ proto.jspb.test.TestGroup.prototype.getId = function() { * @param {string} value * @return {!proto.jspb.test.TestGroup} returns this */ -proto.jspb.test.TestGroup.prototype.setId = function(value) { +TestGroup.prototype.setId = function(value) { return jspb.Message.setField(this, 4, value); }; @@ -7014,7 +6967,7 @@ proto.jspb.test.TestGroup.prototype.setId = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestGroup} returns this */ -proto.jspb.test.TestGroup.prototype.clearId = function() { +TestGroup.prototype.clearId = function() { return jspb.Message.setField(this, 4, undefined); }; @@ -7023,7 +6976,7 @@ proto.jspb.test.TestGroup.prototype.clearId = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestGroup.prototype.hasId = function() { +TestGroup.prototype.hasId = function() { return jspb.Message.getField(this, 4) != null; }; @@ -7032,9 +6985,9 @@ proto.jspb.test.TestGroup.prototype.hasId = function() { * required Simple2 required_simple = 5; * @return {!proto.jspb.test.Simple2} */ -proto.jspb.test.TestGroup.prototype.getRequiredSimple = function() { +TestGroup.prototype.getRequiredSimple = function() { return /** @type{!proto.jspb.test.Simple2} */ ( - jspb.Message.getWrapperField(this, proto.jspb.test.Simple2, 5, 1)); + jspb.Message.getWrapperField(this, Simple2, 5, 1)); }; @@ -7042,7 +6995,7 @@ proto.jspb.test.TestGroup.prototype.getRequiredSimple = function() { * @param {!proto.jspb.test.Simple2} value * @return {!proto.jspb.test.TestGroup} returns this */ -proto.jspb.test.TestGroup.prototype.setRequiredSimple = function(value) { +TestGroup.prototype.setRequiredSimple = function(value) { return jspb.Message.setWrapperField(this, 5, value); }; @@ -7051,7 +7004,7 @@ proto.jspb.test.TestGroup.prototype.setRequiredSimple = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestGroup} returns this */ -proto.jspb.test.TestGroup.prototype.clearRequiredSimple = function() { +TestGroup.prototype.clearRequiredSimple = function() { return jspb.Message.setField(this, 5, undefined); }; @@ -7060,7 +7013,7 @@ proto.jspb.test.TestGroup.prototype.clearRequiredSimple = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestGroup.prototype.hasRequiredSimple = function() { +TestGroup.prototype.hasRequiredSimple = function() { return jspb.Message.getField(this, 5) != null; }; @@ -7069,9 +7022,9 @@ proto.jspb.test.TestGroup.prototype.hasRequiredSimple = function() { * optional Simple2 optional_simple = 6; * @return {?proto.jspb.test.Simple2} */ -proto.jspb.test.TestGroup.prototype.getOptionalSimple = function() { +TestGroup.prototype.getOptionalSimple = function() { return /** @type{?proto.jspb.test.Simple2} */ ( - jspb.Message.getWrapperField(this, proto.jspb.test.Simple2, 6)); + jspb.Message.getWrapperField(this, Simple2, 6)); }; @@ -7079,7 +7032,7 @@ proto.jspb.test.TestGroup.prototype.getOptionalSimple = function() { * @param {?proto.jspb.test.Simple2|undefined} value * @return {!proto.jspb.test.TestGroup} returns this */ -proto.jspb.test.TestGroup.prototype.setOptionalSimple = function(value) { +TestGroup.prototype.setOptionalSimple = function(value) { return jspb.Message.setWrapperField(this, 6, value); }; @@ -7088,7 +7041,7 @@ proto.jspb.test.TestGroup.prototype.setOptionalSimple = function(value) { * Clears the message field making it undefined. * @return {!proto.jspb.test.TestGroup} returns this */ -proto.jspb.test.TestGroup.prototype.clearOptionalSimple = function() { +TestGroup.prototype.clearOptionalSimple = function() { return this.setOptionalSimple(undefined); }; @@ -7097,7 +7050,7 @@ proto.jspb.test.TestGroup.prototype.clearOptionalSimple = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestGroup.prototype.hasOptionalSimple = function() { +TestGroup.prototype.hasOptionalSimple = function() { return jspb.Message.getField(this, 6) != null; }; @@ -7118,8 +7071,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestGroup1.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestGroup1.toObject(opt_includeInstance, this); +TestGroup1.prototype.toObject = function(opt_includeInstance) { + return TestGroup1.toObject(opt_includeInstance, this); }; @@ -7132,9 +7085,9 @@ proto.jspb.test.TestGroup1.prototype.toObject = function(opt_includeInstance) { * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestGroup1.toObject = function(includeInstance, msg) { +TestGroup1.toObject = function(includeInstance, msg) { var f, obj = { -group: (f = msg.getGroup()) && proto.jspb.test.TestGroup.RepeatedGroup.toObject(includeInstance, f) +group: (f = msg.getGroup()) && TestGroup.RepeatedGroup.toObject(includeInstance, f) }; if (includeInstance) { @@ -7150,10 +7103,10 @@ group: (f = msg.getGroup()) && proto.jspb.test.TestGroup.RepeatedGroup.toObject( * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestGroup1} */ -proto.jspb.test.TestGroup1.deserializeBinary = function(bytes) { +TestGroup1.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestGroup1; - return proto.jspb.test.TestGroup1.deserializeBinaryFromReader(msg, reader); + var msg = new TestGroup1; + return TestGroup1.deserializeBinaryFromReader(msg, reader); }; @@ -7164,7 +7117,7 @@ proto.jspb.test.TestGroup1.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestGroup1} */ -proto.jspb.test.TestGroup1.deserializeBinaryFromReader = function(msg, reader) { +TestGroup1.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7172,8 +7125,8 @@ proto.jspb.test.TestGroup1.deserializeBinaryFromReader = function(msg, reader) { var field = reader.getFieldNumber(); switch (field) { case 1: - var value = new proto.jspb.test.TestGroup.RepeatedGroup; - reader.readMessage(value,proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader); + var value = new TestGroup.RepeatedGroup; + reader.readMessage(value,TestGroup.RepeatedGroup.deserializeBinaryFromReader); msg.setGroup(value); break; default: @@ -7189,9 +7142,9 @@ proto.jspb.test.TestGroup1.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestGroup1.prototype.serializeBinary = function() { +TestGroup1.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestGroup1.serializeBinaryToWriter(this, writer); + TestGroup1.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7203,14 +7156,14 @@ proto.jspb.test.TestGroup1.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestGroup1.serializeBinaryToWriter = function(message, writer) { +TestGroup1.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getGroup(); if (f != null) { writer.writeMessage( 1, f, - proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter + TestGroup.RepeatedGroup.serializeBinaryToWriter ); } }; @@ -7220,9 +7173,9 @@ proto.jspb.test.TestGroup1.serializeBinaryToWriter = function(message, writer) { * optional TestGroup.RepeatedGroup group = 1; * @return {?proto.jspb.test.TestGroup.RepeatedGroup} */ -proto.jspb.test.TestGroup1.prototype.getGroup = function() { +TestGroup1.prototype.getGroup = function() { return /** @type{?proto.jspb.test.TestGroup.RepeatedGroup} */ ( - jspb.Message.getWrapperField(this, proto.jspb.test.TestGroup.RepeatedGroup, 1)); + jspb.Message.getWrapperField(this, TestGroup.RepeatedGroup, 1)); }; @@ -7230,7 +7183,7 @@ proto.jspb.test.TestGroup1.prototype.getGroup = function() { * @param {?proto.jspb.test.TestGroup.RepeatedGroup|undefined} value * @return {!proto.jspb.test.TestGroup1} returns this */ -proto.jspb.test.TestGroup1.prototype.setGroup = function(value) { +TestGroup1.prototype.setGroup = function(value) { return jspb.Message.setWrapperField(this, 1, value); }; @@ -7239,7 +7192,7 @@ proto.jspb.test.TestGroup1.prototype.setGroup = function(value) { * Clears the message field making it undefined. * @return {!proto.jspb.test.TestGroup1} returns this */ -proto.jspb.test.TestGroup1.prototype.clearGroup = function() { +TestGroup1.prototype.clearGroup = function() { return this.setGroup(undefined); }; @@ -7248,7 +7201,7 @@ proto.jspb.test.TestGroup1.prototype.clearGroup = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestGroup1.prototype.hasGroup = function() { +TestGroup1.prototype.hasGroup = function() { return jspb.Message.getField(this, 1) != null; }; @@ -7269,8 +7222,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestReservedNames.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestReservedNames.toObject(opt_includeInstance, this); +TestReservedNames.prototype.toObject = function(opt_includeInstance) { + return TestReservedNames.toObject(opt_includeInstance, this); }; @@ -7283,13 +7236,13 @@ proto.jspb.test.TestReservedNames.prototype.toObject = function(opt_includeInsta * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestReservedNames.toObject = function(includeInstance, msg) { +TestReservedNames.toObject = function(includeInstance, msg) { var f, obj = { extension: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, - proto.jspb.test.TestReservedNames.extensions, proto.jspb.test.TestReservedNames.prototype.getExtension, + TestReservedNames.extensions, TestReservedNames.prototype.getExtension, includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; @@ -7304,10 +7257,10 @@ extension: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestReservedNames} */ -proto.jspb.test.TestReservedNames.deserializeBinary = function(bytes) { +TestReservedNames.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestReservedNames; - return proto.jspb.test.TestReservedNames.deserializeBinaryFromReader(msg, reader); + var msg = new TestReservedNames; + return TestReservedNames.deserializeBinaryFromReader(msg, reader); }; @@ -7318,7 +7271,7 @@ proto.jspb.test.TestReservedNames.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestReservedNames} */ -proto.jspb.test.TestReservedNames.deserializeBinaryFromReader = function(msg, reader) { +TestReservedNames.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7331,9 +7284,9 @@ proto.jspb.test.TestReservedNames.deserializeBinaryFromReader = function(msg, re break; default: jspb.Message.readBinaryExtension(msg, reader, - proto.jspb.test.TestReservedNames.extensionsBinary, - proto.jspb.test.TestReservedNames.prototype.getExtension, - proto.jspb.test.TestReservedNames.prototype.setExtension); + TestReservedNames.extensionsBinary, + TestReservedNames.prototype.getExtension, + TestReservedNames.prototype.setExtension); break; } } @@ -7345,9 +7298,9 @@ proto.jspb.test.TestReservedNames.deserializeBinaryFromReader = function(msg, re * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestReservedNames.prototype.serializeBinary = function() { +TestReservedNames.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestReservedNames.serializeBinaryToWriter(this, writer); + TestReservedNames.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7359,7 +7312,7 @@ proto.jspb.test.TestReservedNames.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestReservedNames.serializeBinaryToWriter = function(message, writer) { +TestReservedNames.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -7369,7 +7322,7 @@ proto.jspb.test.TestReservedNames.serializeBinaryToWriter = function(message, wr ); } jspb.Message.serializeBinaryExtensions(message, writer, - proto.jspb.test.TestReservedNames.extensionsBinary, proto.jspb.test.TestReservedNames.prototype.getExtension); + TestReservedNames.extensionsBinary, TestReservedNames.prototype.getExtension); }; @@ -7377,7 +7330,7 @@ proto.jspb.test.TestReservedNames.serializeBinaryToWriter = function(message, wr * optional int32 extension = 1; * @return {number} */ -proto.jspb.test.TestReservedNames.prototype.getExtension$ = function() { +TestReservedNames.prototype.getExtension$ = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; @@ -7386,7 +7339,7 @@ proto.jspb.test.TestReservedNames.prototype.getExtension$ = function() { * @param {number} value * @return {!proto.jspb.test.TestReservedNames} returns this */ -proto.jspb.test.TestReservedNames.prototype.setExtension$ = function(value) { +TestReservedNames.prototype.setExtension$ = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -7395,7 +7348,7 @@ proto.jspb.test.TestReservedNames.prototype.setExtension$ = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestReservedNames} returns this */ -proto.jspb.test.TestReservedNames.prototype.clearExtension$ = function() { +TestReservedNames.prototype.clearExtension$ = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -7404,7 +7357,7 @@ proto.jspb.test.TestReservedNames.prototype.clearExtension$ = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestReservedNames.prototype.hasExtension$ = function() { +TestReservedNames.prototype.hasExtension$ = function() { return jspb.Message.getField(this, 1) != null; }; @@ -7425,8 +7378,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestReservedNamesExtension.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestReservedNamesExtension.toObject(opt_includeInstance, this); +TestReservedNamesExtension.prototype.toObject = function(opt_includeInstance) { + return TestReservedNamesExtension.toObject(opt_includeInstance, this); }; @@ -7439,7 +7392,7 @@ proto.jspb.test.TestReservedNamesExtension.prototype.toObject = function(opt_inc * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestReservedNamesExtension.toObject = function(includeInstance, msg) { +TestReservedNamesExtension.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -7457,10 +7410,10 @@ proto.jspb.test.TestReservedNamesExtension.toObject = function(includeInstance, * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestReservedNamesExtension} */ -proto.jspb.test.TestReservedNamesExtension.deserializeBinary = function(bytes) { +TestReservedNamesExtension.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestReservedNamesExtension; - return proto.jspb.test.TestReservedNamesExtension.deserializeBinaryFromReader(msg, reader); + var msg = new TestReservedNamesExtension; + return TestReservedNamesExtension.deserializeBinaryFromReader(msg, reader); }; @@ -7471,7 +7424,7 @@ proto.jspb.test.TestReservedNamesExtension.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestReservedNamesExtension} */ -proto.jspb.test.TestReservedNamesExtension.deserializeBinaryFromReader = function(msg, reader) { +TestReservedNamesExtension.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7491,9 +7444,9 @@ proto.jspb.test.TestReservedNamesExtension.deserializeBinaryFromReader = functio * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestReservedNamesExtension.prototype.serializeBinary = function() { +TestReservedNamesExtension.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestReservedNamesExtension.serializeBinaryToWriter(this, writer); + TestReservedNamesExtension.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7505,7 +7458,7 @@ proto.jspb.test.TestReservedNamesExtension.prototype.serializeBinary = function( * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestReservedNamesExtension.serializeBinaryToWriter = function(message, writer) { +TestReservedNamesExtension.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; @@ -7516,7 +7469,7 @@ proto.jspb.test.TestReservedNamesExtension.serializeBinaryToWriter = function(me * field named `foo`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( +TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( 10, {foo: 0}, null, @@ -7524,8 +7477,8 @@ proto.jspb.test.TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( null), 0); -proto.jspb.test.TestReservedNames.extensionsBinary[10] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.TestReservedNamesExtension.foo, +TestReservedNames.extensionsBinary[10] = new jspb.ExtensionFieldBinaryInfo( + TestReservedNamesExtension.foo, jspb.BinaryReader.prototype.readInt32, jspb.BinaryWriter.prototype.writeInt32, undefined, @@ -7533,7 +7486,7 @@ proto.jspb.test.TestReservedNames.extensionsBinary[10] = new jspb.ExtensionField false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.TestReservedNames.extensions[10] = proto.jspb.test.TestReservedNamesExtension.foo; +TestReservedNames.extensions[10] = TestReservedNamesExtension.foo; /** @@ -7541,7 +7494,7 @@ proto.jspb.test.TestReservedNames.extensions[10] = proto.jspb.test.TestReservedN * field named `foo`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( +TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( 10, {foo: 0}, null, @@ -7549,8 +7502,8 @@ proto.jspb.test.TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( null), 0); -proto.jspb.test.TestReservedNames.extensionsBinary[10] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.TestReservedNamesExtension.foo, +TestReservedNames.extensionsBinary[10] = new jspb.ExtensionFieldBinaryInfo( + TestReservedNamesExtension.foo, jspb.BinaryReader.prototype.readInt32, jspb.BinaryWriter.prototype.writeInt32, undefined, @@ -7558,7 +7511,7 @@ proto.jspb.test.TestReservedNames.extensionsBinary[10] = new jspb.ExtensionField false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.TestReservedNames.extensions[10] = proto.jspb.test.TestReservedNamesExtension.foo; +TestReservedNames.extensions[10] = TestReservedNamesExtension.foo; /** @@ -7566,7 +7519,7 @@ proto.jspb.test.TestReservedNames.extensions[10] = proto.jspb.test.TestReservedN * @private {!Array} * @const */ -proto.jspb.test.TestMessageWithOneof.repeatedFields_ = [9]; +TestMessageWithOneof.repeatedFields_ = [9]; /** * Oneof group definitions for this message. Each group defines the field @@ -7576,12 +7529,12 @@ proto.jspb.test.TestMessageWithOneof.repeatedFields_ = [9]; * @private {!Array>} * @const */ -proto.jspb.test.TestMessageWithOneof.oneofGroups_ = [[3,5],[6,7],[10,11],[12,13]]; +TestMessageWithOneof.oneofGroups_ = [[3,5],[6,7],[10,11],[12,13]]; /** * @enum {number} */ -proto.jspb.test.TestMessageWithOneof.PartialOneofCase = { +TestMessageWithOneof.PartialOneofCase = { PARTIAL_ONEOF_NOT_SET: 0, PONE: 3, PTHREE: 5 @@ -7590,14 +7543,14 @@ proto.jspb.test.TestMessageWithOneof.PartialOneofCase = { /** * @return {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} */ -proto.jspb.test.TestMessageWithOneof.prototype.getPartialOneofCase = function() { - return /** @type {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0])); +TestMessageWithOneof.prototype.getPartialOneofCase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[0])); }; /** * @enum {number} */ -proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase = { +TestMessageWithOneof.RecursiveOneofCase = { RECURSIVE_ONEOF_NOT_SET: 0, RONE: 6, RTWO: 7 @@ -7606,14 +7559,14 @@ proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase = { /** * @return {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} */ -proto.jspb.test.TestMessageWithOneof.prototype.getRecursiveOneofCase = function() { - return /** @type {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1])); +TestMessageWithOneof.prototype.getRecursiveOneofCase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[1])); }; /** * @enum {number} */ -proto.jspb.test.TestMessageWithOneof.DefaultOneofACase = { +TestMessageWithOneof.DefaultOneofACase = { DEFAULT_ONEOF_A_NOT_SET: 0, AONE: 10, ATWO: 11 @@ -7622,14 +7575,14 @@ proto.jspb.test.TestMessageWithOneof.DefaultOneofACase = { /** * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} */ -proto.jspb.test.TestMessageWithOneof.prototype.getDefaultOneofACase = function() { - return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2])); +TestMessageWithOneof.prototype.getDefaultOneofACase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[2])); }; /** * @enum {number} */ -proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase = { +TestMessageWithOneof.DefaultOneofBCase = { DEFAULT_ONEOF_B_NOT_SET: 0, BONE: 12, BTWO: 13 @@ -7638,8 +7591,8 @@ proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase = { /** * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} */ -proto.jspb.test.TestMessageWithOneof.prototype.getDefaultOneofBCase = function() { - return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3])); +TestMessageWithOneof.prototype.getDefaultOneofBCase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[3])); }; @@ -7657,8 +7610,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestMessageWithOneof.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestMessageWithOneof.toObject(opt_includeInstance, this); +TestMessageWithOneof.prototype.toObject = function(opt_includeInstance) { + return TestMessageWithOneof.toObject(opt_includeInstance, this); }; @@ -7671,11 +7624,11 @@ proto.jspb.test.TestMessageWithOneof.prototype.toObject = function(opt_includeIn * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestMessageWithOneof.toObject = function(includeInstance, msg) { +TestMessageWithOneof.toObject = function(includeInstance, msg) { var f, obj = { pone: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, pthree: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f, -rone: (f = msg.getRone()) && proto.jspb.test.TestMessageWithOneof.toObject(includeInstance, f), +rone: (f = msg.getRone()) && TestMessageWithOneof.toObject(includeInstance, f), rtwo: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f, normalField: (f = jspb.Message.getBooleanField(msg, 8)) == null ? undefined : f, repeatedFieldList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f, @@ -7698,10 +7651,10 @@ btwo: jspb.Message.getFieldWithDefault(msg, 13, 1234) * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestMessageWithOneof} */ -proto.jspb.test.TestMessageWithOneof.deserializeBinary = function(bytes) { +TestMessageWithOneof.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestMessageWithOneof; - return proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader(msg, reader); + var msg = new TestMessageWithOneof; + return TestMessageWithOneof.deserializeBinaryFromReader(msg, reader); }; @@ -7712,7 +7665,7 @@ proto.jspb.test.TestMessageWithOneof.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestMessageWithOneof} */ -proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader = function(msg, reader) { +TestMessageWithOneof.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -7728,8 +7681,8 @@ proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader = function(msg, msg.setPthree(value); break; case 6: - var value = new proto.jspb.test.TestMessageWithOneof; - reader.readMessage(value,proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader); + var value = new TestMessageWithOneof; + reader.readMessage(value,TestMessageWithOneof.deserializeBinaryFromReader); msg.setRone(value); break; case 7: @@ -7773,9 +7726,9 @@ proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader = function(msg, * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestMessageWithOneof.prototype.serializeBinary = function() { +TestMessageWithOneof.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter(this, writer); + TestMessageWithOneof.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -7787,7 +7740,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter = function(message, writer) { +TestMessageWithOneof.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {string} */ (jspb.Message.getField(message, 3)); if (f != null) { @@ -7808,7 +7761,7 @@ proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter = function(message, writer.writeMessage( 6, f, - proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter + TestMessageWithOneof.serializeBinaryToWriter ); } f = /** @type {string} */ (jspb.Message.getField(message, 7)); @@ -7867,7 +7820,7 @@ proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter = function(message, * optional string pone = 3; * @return {string} */ -proto.jspb.test.TestMessageWithOneof.prototype.getPone = function() { +TestMessageWithOneof.prototype.getPone = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); }; @@ -7876,8 +7829,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.getPone = function() { * @param {string} value * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.setPone = function(value) { - return jspb.Message.setOneofField(this, 3, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], value); +TestMessageWithOneof.prototype.setPone = function(value) { + return jspb.Message.setOneofField(this, 3, TestMessageWithOneof.oneofGroups_[0], value); }; @@ -7885,8 +7838,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.setPone = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.clearPone = function() { - return jspb.Message.setOneofField(this, 3, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], undefined); +TestMessageWithOneof.prototype.clearPone = function() { + return jspb.Message.setOneofField(this, 3, TestMessageWithOneof.oneofGroups_[0], undefined); }; @@ -7894,7 +7847,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.clearPone = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestMessageWithOneof.prototype.hasPone = function() { +TestMessageWithOneof.prototype.hasPone = function() { return jspb.Message.getField(this, 3) != null; }; @@ -7903,7 +7856,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.hasPone = function() { * optional string pthree = 5; * @return {string} */ -proto.jspb.test.TestMessageWithOneof.prototype.getPthree = function() { +TestMessageWithOneof.prototype.getPthree = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); }; @@ -7912,8 +7865,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.getPthree = function() { * @param {string} value * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.setPthree = function(value) { - return jspb.Message.setOneofField(this, 5, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], value); +TestMessageWithOneof.prototype.setPthree = function(value) { + return jspb.Message.setOneofField(this, 5, TestMessageWithOneof.oneofGroups_[0], value); }; @@ -7921,8 +7874,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.setPthree = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.clearPthree = function() { - return jspb.Message.setOneofField(this, 5, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], undefined); +TestMessageWithOneof.prototype.clearPthree = function() { + return jspb.Message.setOneofField(this, 5, TestMessageWithOneof.oneofGroups_[0], undefined); }; @@ -7930,7 +7883,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.clearPthree = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestMessageWithOneof.prototype.hasPthree = function() { +TestMessageWithOneof.prototype.hasPthree = function() { return jspb.Message.getField(this, 5) != null; }; @@ -7939,9 +7892,9 @@ proto.jspb.test.TestMessageWithOneof.prototype.hasPthree = function() { * optional TestMessageWithOneof rone = 6; * @return {?proto.jspb.test.TestMessageWithOneof} */ -proto.jspb.test.TestMessageWithOneof.prototype.getRone = function() { +TestMessageWithOneof.prototype.getRone = function() { return /** @type{?proto.jspb.test.TestMessageWithOneof} */ ( - jspb.Message.getWrapperField(this, proto.jspb.test.TestMessageWithOneof, 6)); + jspb.Message.getWrapperField(this, TestMessageWithOneof, 6)); }; @@ -7949,8 +7902,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.getRone = function() { * @param {?proto.jspb.test.TestMessageWithOneof|undefined} value * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.setRone = function(value) { - return jspb.Message.setOneofWrapperField(this, 6, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1], value); +TestMessageWithOneof.prototype.setRone = function(value) { + return jspb.Message.setOneofWrapperField(this, 6, TestMessageWithOneof.oneofGroups_[1], value); }; @@ -7958,7 +7911,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.setRone = function(value) { * Clears the message field making it undefined. * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.clearRone = function() { +TestMessageWithOneof.prototype.clearRone = function() { return this.setRone(undefined); }; @@ -7967,7 +7920,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.clearRone = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestMessageWithOneof.prototype.hasRone = function() { +TestMessageWithOneof.prototype.hasRone = function() { return jspb.Message.getField(this, 6) != null; }; @@ -7976,7 +7929,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.hasRone = function() { * optional string rtwo = 7; * @return {string} */ -proto.jspb.test.TestMessageWithOneof.prototype.getRtwo = function() { +TestMessageWithOneof.prototype.getRtwo = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); }; @@ -7985,8 +7938,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.getRtwo = function() { * @param {string} value * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.setRtwo = function(value) { - return jspb.Message.setOneofField(this, 7, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1], value); +TestMessageWithOneof.prototype.setRtwo = function(value) { + return jspb.Message.setOneofField(this, 7, TestMessageWithOneof.oneofGroups_[1], value); }; @@ -7994,8 +7947,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.setRtwo = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.clearRtwo = function() { - return jspb.Message.setOneofField(this, 7, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1], undefined); +TestMessageWithOneof.prototype.clearRtwo = function() { + return jspb.Message.setOneofField(this, 7, TestMessageWithOneof.oneofGroups_[1], undefined); }; @@ -8003,7 +7956,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.clearRtwo = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestMessageWithOneof.prototype.hasRtwo = function() { +TestMessageWithOneof.prototype.hasRtwo = function() { return jspb.Message.getField(this, 7) != null; }; @@ -8012,7 +7965,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.hasRtwo = function() { * optional bool normal_field = 8; * @return {boolean} */ -proto.jspb.test.TestMessageWithOneof.prototype.getNormalField = function() { +TestMessageWithOneof.prototype.getNormalField = function() { return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); }; @@ -8021,7 +7974,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.getNormalField = function() { * @param {boolean} value * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.setNormalField = function(value) { +TestMessageWithOneof.prototype.setNormalField = function(value) { return jspb.Message.setField(this, 8, value); }; @@ -8030,7 +7983,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.setNormalField = function(value) * Clears the field making it undefined. * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.clearNormalField = function() { +TestMessageWithOneof.prototype.clearNormalField = function() { return jspb.Message.setField(this, 8, undefined); }; @@ -8039,7 +7992,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.clearNormalField = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestMessageWithOneof.prototype.hasNormalField = function() { +TestMessageWithOneof.prototype.hasNormalField = function() { return jspb.Message.getField(this, 8) != null; }; @@ -8048,7 +8001,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.hasNormalField = function() { * repeated string repeated_field = 9; * @return {!Array} */ -proto.jspb.test.TestMessageWithOneof.prototype.getRepeatedFieldList = function() { +TestMessageWithOneof.prototype.getRepeatedFieldList = function() { return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 9)); }; @@ -8057,7 +8010,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.getRepeatedFieldList = function() * @param {!Array} value * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.setRepeatedFieldList = function(value) { +TestMessageWithOneof.prototype.setRepeatedFieldList = function(value) { return jspb.Message.setField(this, 9, value || []); }; @@ -8067,7 +8020,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.setRepeatedFieldList = function(v * @param {number=} opt_index * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.addRepeatedField = function(value, opt_index) { +TestMessageWithOneof.prototype.addRepeatedField = function(value, opt_index) { return jspb.Message.addToRepeatedField(this, 9, value, opt_index); }; @@ -8076,7 +8029,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.addRepeatedField = function(value * Clears the list making it empty but non-null. * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.clearRepeatedFieldList = function() { +TestMessageWithOneof.prototype.clearRepeatedFieldList = function() { return this.setRepeatedFieldList([]); }; @@ -8085,7 +8038,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.clearRepeatedFieldList = function * optional int32 aone = 10; * @return {number} */ -proto.jspb.test.TestMessageWithOneof.prototype.getAone = function() { +TestMessageWithOneof.prototype.getAone = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 10, 1234)); }; @@ -8094,8 +8047,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.getAone = function() { * @param {number} value * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.setAone = function(value) { - return jspb.Message.setOneofField(this, 10, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], value); +TestMessageWithOneof.prototype.setAone = function(value) { + return jspb.Message.setOneofField(this, 10, TestMessageWithOneof.oneofGroups_[2], value); }; @@ -8103,8 +8056,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.setAone = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.clearAone = function() { - return jspb.Message.setOneofField(this, 10, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], undefined); +TestMessageWithOneof.prototype.clearAone = function() { + return jspb.Message.setOneofField(this, 10, TestMessageWithOneof.oneofGroups_[2], undefined); }; @@ -8112,7 +8065,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.clearAone = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestMessageWithOneof.prototype.hasAone = function() { +TestMessageWithOneof.prototype.hasAone = function() { return jspb.Message.getField(this, 10) != null; }; @@ -8121,7 +8074,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.hasAone = function() { * optional int32 atwo = 11; * @return {number} */ -proto.jspb.test.TestMessageWithOneof.prototype.getAtwo = function() { +TestMessageWithOneof.prototype.getAtwo = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); }; @@ -8130,8 +8083,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.getAtwo = function() { * @param {number} value * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.setAtwo = function(value) { - return jspb.Message.setOneofField(this, 11, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], value); +TestMessageWithOneof.prototype.setAtwo = function(value) { + return jspb.Message.setOneofField(this, 11, TestMessageWithOneof.oneofGroups_[2], value); }; @@ -8139,8 +8092,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.setAtwo = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.clearAtwo = function() { - return jspb.Message.setOneofField(this, 11, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], undefined); +TestMessageWithOneof.prototype.clearAtwo = function() { + return jspb.Message.setOneofField(this, 11, TestMessageWithOneof.oneofGroups_[2], undefined); }; @@ -8148,7 +8101,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.clearAtwo = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestMessageWithOneof.prototype.hasAtwo = function() { +TestMessageWithOneof.prototype.hasAtwo = function() { return jspb.Message.getField(this, 11) != null; }; @@ -8157,7 +8110,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.hasAtwo = function() { * optional int32 bone = 12; * @return {number} */ -proto.jspb.test.TestMessageWithOneof.prototype.getBone = function() { +TestMessageWithOneof.prototype.getBone = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 12, 0)); }; @@ -8166,8 +8119,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.getBone = function() { * @param {number} value * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.setBone = function(value) { - return jspb.Message.setOneofField(this, 12, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], value); +TestMessageWithOneof.prototype.setBone = function(value) { + return jspb.Message.setOneofField(this, 12, TestMessageWithOneof.oneofGroups_[3], value); }; @@ -8175,8 +8128,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.setBone = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.clearBone = function() { - return jspb.Message.setOneofField(this, 12, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], undefined); +TestMessageWithOneof.prototype.clearBone = function() { + return jspb.Message.setOneofField(this, 12, TestMessageWithOneof.oneofGroups_[3], undefined); }; @@ -8184,7 +8137,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.clearBone = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestMessageWithOneof.prototype.hasBone = function() { +TestMessageWithOneof.prototype.hasBone = function() { return jspb.Message.getField(this, 12) != null; }; @@ -8193,7 +8146,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.hasBone = function() { * optional int32 btwo = 13; * @return {number} */ -proto.jspb.test.TestMessageWithOneof.prototype.getBtwo = function() { +TestMessageWithOneof.prototype.getBtwo = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 1234)); }; @@ -8202,8 +8155,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.getBtwo = function() { * @param {number} value * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.setBtwo = function(value) { - return jspb.Message.setOneofField(this, 13, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], value); +TestMessageWithOneof.prototype.setBtwo = function(value) { + return jspb.Message.setOneofField(this, 13, TestMessageWithOneof.oneofGroups_[3], value); }; @@ -8211,8 +8164,8 @@ proto.jspb.test.TestMessageWithOneof.prototype.setBtwo = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestMessageWithOneof} returns this */ -proto.jspb.test.TestMessageWithOneof.prototype.clearBtwo = function() { - return jspb.Message.setOneofField(this, 13, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], undefined); +TestMessageWithOneof.prototype.clearBtwo = function() { + return jspb.Message.setOneofField(this, 13, TestMessageWithOneof.oneofGroups_[3], undefined); }; @@ -8220,7 +8173,7 @@ proto.jspb.test.TestMessageWithOneof.prototype.clearBtwo = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestMessageWithOneof.prototype.hasBtwo = function() { +TestMessageWithOneof.prototype.hasBtwo = function() { return jspb.Message.getField(this, 13) != null; }; @@ -8241,8 +8194,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestEndsWithBytes.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestEndsWithBytes.toObject(opt_includeInstance, this); +TestEndsWithBytes.prototype.toObject = function(opt_includeInstance) { + return TestEndsWithBytes.toObject(opt_includeInstance, this); }; @@ -8255,7 +8208,7 @@ proto.jspb.test.TestEndsWithBytes.prototype.toObject = function(opt_includeInsta * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestEndsWithBytes.toObject = function(includeInstance, msg) { +TestEndsWithBytes.toObject = function(includeInstance, msg) { var f, obj = { value: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, data: msg.getData_asB64() @@ -8274,10 +8227,10 @@ data: msg.getData_asB64() * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestEndsWithBytes} */ -proto.jspb.test.TestEndsWithBytes.deserializeBinary = function(bytes) { +TestEndsWithBytes.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestEndsWithBytes; - return proto.jspb.test.TestEndsWithBytes.deserializeBinaryFromReader(msg, reader); + var msg = new TestEndsWithBytes; + return TestEndsWithBytes.deserializeBinaryFromReader(msg, reader); }; @@ -8288,7 +8241,7 @@ proto.jspb.test.TestEndsWithBytes.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestEndsWithBytes} */ -proto.jspb.test.TestEndsWithBytes.deserializeBinaryFromReader = function(msg, reader) { +TestEndsWithBytes.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8316,9 +8269,9 @@ proto.jspb.test.TestEndsWithBytes.deserializeBinaryFromReader = function(msg, re * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestEndsWithBytes.prototype.serializeBinary = function() { +TestEndsWithBytes.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestEndsWithBytes.serializeBinaryToWriter(this, writer); + TestEndsWithBytes.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8330,7 +8283,7 @@ proto.jspb.test.TestEndsWithBytes.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestEndsWithBytes.serializeBinaryToWriter = function(message, writer) { +TestEndsWithBytes.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -8353,7 +8306,7 @@ proto.jspb.test.TestEndsWithBytes.serializeBinaryToWriter = function(message, wr * optional int32 value = 1; * @return {number} */ -proto.jspb.test.TestEndsWithBytes.prototype.getValue = function() { +TestEndsWithBytes.prototype.getValue = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; @@ -8362,7 +8315,7 @@ proto.jspb.test.TestEndsWithBytes.prototype.getValue = function() { * @param {number} value * @return {!proto.jspb.test.TestEndsWithBytes} returns this */ -proto.jspb.test.TestEndsWithBytes.prototype.setValue = function(value) { +TestEndsWithBytes.prototype.setValue = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -8371,7 +8324,7 @@ proto.jspb.test.TestEndsWithBytes.prototype.setValue = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestEndsWithBytes} returns this */ -proto.jspb.test.TestEndsWithBytes.prototype.clearValue = function() { +TestEndsWithBytes.prototype.clearValue = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -8380,7 +8333,7 @@ proto.jspb.test.TestEndsWithBytes.prototype.clearValue = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestEndsWithBytes.prototype.hasValue = function() { +TestEndsWithBytes.prototype.hasValue = function() { return jspb.Message.getField(this, 1) != null; }; @@ -8389,7 +8342,7 @@ proto.jspb.test.TestEndsWithBytes.prototype.hasValue = function() { * optional bytes data = 2; * @return {!(string|Uint8Array)} */ -proto.jspb.test.TestEndsWithBytes.prototype.getData = function() { +TestEndsWithBytes.prototype.getData = function() { return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; @@ -8399,7 +8352,7 @@ proto.jspb.test.TestEndsWithBytes.prototype.getData = function() { * This is a type-conversion wrapper around `getData()` * @return {string} */ -proto.jspb.test.TestEndsWithBytes.prototype.getData_asB64 = function() { +TestEndsWithBytes.prototype.getData_asB64 = function() { return /** @type {string} */ (jspb.Message.bytesAsB64( this.getData())); }; @@ -8412,7 +8365,7 @@ proto.jspb.test.TestEndsWithBytes.prototype.getData_asB64 = function() { * This is a type-conversion wrapper around `getData()` * @return {!Uint8Array} */ -proto.jspb.test.TestEndsWithBytes.prototype.getData_asU8 = function() { +TestEndsWithBytes.prototype.getData_asU8 = function() { return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( this.getData())); }; @@ -8422,7 +8375,7 @@ proto.jspb.test.TestEndsWithBytes.prototype.getData_asU8 = function() { * @param {!(string|Uint8Array)} value * @return {!proto.jspb.test.TestEndsWithBytes} returns this */ -proto.jspb.test.TestEndsWithBytes.prototype.setData = function(value) { +TestEndsWithBytes.prototype.setData = function(value) { return jspb.Message.setField(this, 2, value); }; @@ -8431,7 +8384,7 @@ proto.jspb.test.TestEndsWithBytes.prototype.setData = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.TestEndsWithBytes} returns this */ -proto.jspb.test.TestEndsWithBytes.prototype.clearData = function() { +TestEndsWithBytes.prototype.clearData = function() { return jspb.Message.setField(this, 2, undefined); }; @@ -8440,7 +8393,7 @@ proto.jspb.test.TestEndsWithBytes.prototype.clearData = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestEndsWithBytes.prototype.hasData = function() { +TestEndsWithBytes.prototype.hasData = function() { return jspb.Message.getField(this, 2) != null; }; @@ -8461,8 +8414,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestLastFieldBeforePivot.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestLastFieldBeforePivot.toObject(opt_includeInstance, this); +TestLastFieldBeforePivot.prototype.toObject = function(opt_includeInstance) { + return TestLastFieldBeforePivot.toObject(opt_includeInstance, this); }; @@ -8475,13 +8428,13 @@ proto.jspb.test.TestLastFieldBeforePivot.prototype.toObject = function(opt_inclu * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestLastFieldBeforePivot.toObject = function(includeInstance, msg) { +TestLastFieldBeforePivot.toObject = function(includeInstance, msg) { var f, obj = { lastFieldBeforePivot: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, - proto.jspb.test.TestLastFieldBeforePivot.extensions, proto.jspb.test.TestLastFieldBeforePivot.prototype.getExtension, + TestLastFieldBeforePivot.extensions, TestLastFieldBeforePivot.prototype.getExtension, includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; @@ -8496,10 +8449,10 @@ lastFieldBeforePivot: (f = jspb.Message.getField(msg, 1)) == null ? undefined : * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestLastFieldBeforePivot} */ -proto.jspb.test.TestLastFieldBeforePivot.deserializeBinary = function(bytes) { +TestLastFieldBeforePivot.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestLastFieldBeforePivot; - return proto.jspb.test.TestLastFieldBeforePivot.deserializeBinaryFromReader(msg, reader); + var msg = new TestLastFieldBeforePivot; + return TestLastFieldBeforePivot.deserializeBinaryFromReader(msg, reader); }; @@ -8510,7 +8463,7 @@ proto.jspb.test.TestLastFieldBeforePivot.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestLastFieldBeforePivot} */ -proto.jspb.test.TestLastFieldBeforePivot.deserializeBinaryFromReader = function(msg, reader) { +TestLastFieldBeforePivot.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8523,9 +8476,9 @@ proto.jspb.test.TestLastFieldBeforePivot.deserializeBinaryFromReader = function( break; default: jspb.Message.readBinaryExtension(msg, reader, - proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary, - proto.jspb.test.TestLastFieldBeforePivot.prototype.getExtension, - proto.jspb.test.TestLastFieldBeforePivot.prototype.setExtension); + TestLastFieldBeforePivot.extensionsBinary, + TestLastFieldBeforePivot.prototype.getExtension, + TestLastFieldBeforePivot.prototype.setExtension); break; } } @@ -8537,9 +8490,9 @@ proto.jspb.test.TestLastFieldBeforePivot.deserializeBinaryFromReader = function( * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestLastFieldBeforePivot.prototype.serializeBinary = function() { +TestLastFieldBeforePivot.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestLastFieldBeforePivot.serializeBinaryToWriter(this, writer); + TestLastFieldBeforePivot.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8551,7 +8504,7 @@ proto.jspb.test.TestLastFieldBeforePivot.prototype.serializeBinary = function() * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestLastFieldBeforePivot.serializeBinaryToWriter = function(message, writer) { +TestLastFieldBeforePivot.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -8561,7 +8514,7 @@ proto.jspb.test.TestLastFieldBeforePivot.serializeBinaryToWriter = function(mess ); } jspb.Message.serializeBinaryExtensions(message, writer, - proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary, proto.jspb.test.TestLastFieldBeforePivot.prototype.getExtension); + TestLastFieldBeforePivot.extensionsBinary, TestLastFieldBeforePivot.prototype.getExtension); }; @@ -8569,7 +8522,7 @@ proto.jspb.test.TestLastFieldBeforePivot.serializeBinaryToWriter = function(mess * optional int32 last_field_before_pivot = 1; * @return {number} */ -proto.jspb.test.TestLastFieldBeforePivot.prototype.getLastFieldBeforePivot = function() { +TestLastFieldBeforePivot.prototype.getLastFieldBeforePivot = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; @@ -8578,7 +8531,7 @@ proto.jspb.test.TestLastFieldBeforePivot.prototype.getLastFieldBeforePivot = fun * @param {number} value * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this */ -proto.jspb.test.TestLastFieldBeforePivot.prototype.setLastFieldBeforePivot = function(value) { +TestLastFieldBeforePivot.prototype.setLastFieldBeforePivot = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -8587,7 +8540,7 @@ proto.jspb.test.TestLastFieldBeforePivot.prototype.setLastFieldBeforePivot = fun * Clears the field making it undefined. * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this */ -proto.jspb.test.TestLastFieldBeforePivot.prototype.clearLastFieldBeforePivot = function() { +TestLastFieldBeforePivot.prototype.clearLastFieldBeforePivot = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -8596,7 +8549,7 @@ proto.jspb.test.TestLastFieldBeforePivot.prototype.clearLastFieldBeforePivot = f * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestLastFieldBeforePivot.prototype.hasLastFieldBeforePivot = function() { +TestLastFieldBeforePivot.prototype.hasLastFieldBeforePivot = function() { return jspb.Message.getField(this, 1) != null; }; @@ -8617,8 +8570,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.Int64Types.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.Int64Types.toObject(opt_includeInstance, this); +Int64Types.prototype.toObject = function(opt_includeInstance) { + return Int64Types.toObject(opt_includeInstance, this); }; @@ -8631,7 +8584,7 @@ proto.jspb.test.Int64Types.prototype.toObject = function(opt_includeInstance) { * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Int64Types.toObject = function(includeInstance, msg) { +Int64Types.toObject = function(includeInstance, msg) { var f, obj = { int64Normal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, int64String: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, @@ -8651,10 +8604,10 @@ int64Number: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.Int64Types} */ -proto.jspb.test.Int64Types.deserializeBinary = function(bytes) { +Int64Types.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.Int64Types; - return proto.jspb.test.Int64Types.deserializeBinaryFromReader(msg, reader); + var msg = new Int64Types; + return Int64Types.deserializeBinaryFromReader(msg, reader); }; @@ -8665,7 +8618,7 @@ proto.jspb.test.Int64Types.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.Int64Types} */ -proto.jspb.test.Int64Types.deserializeBinaryFromReader = function(msg, reader) { +Int64Types.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8697,9 +8650,9 @@ proto.jspb.test.Int64Types.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.Int64Types.prototype.serializeBinary = function() { +Int64Types.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.Int64Types.serializeBinaryToWriter(this, writer); + Int64Types.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -8711,7 +8664,7 @@ proto.jspb.test.Int64Types.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Int64Types.serializeBinaryToWriter = function(message, writer) { +Int64Types.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -8741,7 +8694,7 @@ proto.jspb.test.Int64Types.serializeBinaryToWriter = function(message, writer) { * optional int64 int64_normal = 1; * @return {number} */ -proto.jspb.test.Int64Types.prototype.getInt64Normal = function() { +Int64Types.prototype.getInt64Normal = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; @@ -8750,7 +8703,7 @@ proto.jspb.test.Int64Types.prototype.getInt64Normal = function() { * @param {number} value * @return {!proto.jspb.test.Int64Types} returns this */ -proto.jspb.test.Int64Types.prototype.setInt64Normal = function(value) { +Int64Types.prototype.setInt64Normal = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -8759,7 +8712,7 @@ proto.jspb.test.Int64Types.prototype.setInt64Normal = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.Int64Types} returns this */ -proto.jspb.test.Int64Types.prototype.clearInt64Normal = function() { +Int64Types.prototype.clearInt64Normal = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -8768,7 +8721,7 @@ proto.jspb.test.Int64Types.prototype.clearInt64Normal = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.Int64Types.prototype.hasInt64Normal = function() { +Int64Types.prototype.hasInt64Normal = function() { return jspb.Message.getField(this, 1) != null; }; @@ -8777,7 +8730,7 @@ proto.jspb.test.Int64Types.prototype.hasInt64Normal = function() { * optional sint64 int64_string = 2; * @return {string} */ -proto.jspb.test.Int64Types.prototype.getInt64String = function() { +Int64Types.prototype.getInt64String = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); }; @@ -8786,7 +8739,7 @@ proto.jspb.test.Int64Types.prototype.getInt64String = function() { * @param {string} value * @return {!proto.jspb.test.Int64Types} returns this */ -proto.jspb.test.Int64Types.prototype.setInt64String = function(value) { +Int64Types.prototype.setInt64String = function(value) { return jspb.Message.setField(this, 2, value); }; @@ -8795,7 +8748,7 @@ proto.jspb.test.Int64Types.prototype.setInt64String = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.Int64Types} returns this */ -proto.jspb.test.Int64Types.prototype.clearInt64String = function() { +Int64Types.prototype.clearInt64String = function() { return jspb.Message.setField(this, 2, undefined); }; @@ -8804,7 +8757,7 @@ proto.jspb.test.Int64Types.prototype.clearInt64String = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.Int64Types.prototype.hasInt64String = function() { +Int64Types.prototype.hasInt64String = function() { return jspb.Message.getField(this, 2) != null; }; @@ -8813,7 +8766,7 @@ proto.jspb.test.Int64Types.prototype.hasInt64String = function() { * optional uint64 int64_number = 3; * @return {number} */ -proto.jspb.test.Int64Types.prototype.getInt64Number = function() { +Int64Types.prototype.getInt64Number = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); }; @@ -8822,7 +8775,7 @@ proto.jspb.test.Int64Types.prototype.getInt64Number = function() { * @param {number} value * @return {!proto.jspb.test.Int64Types} returns this */ -proto.jspb.test.Int64Types.prototype.setInt64Number = function(value) { +Int64Types.prototype.setInt64Number = function(value) { return jspb.Message.setField(this, 3, value); }; @@ -8831,7 +8784,7 @@ proto.jspb.test.Int64Types.prototype.setInt64Number = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.Int64Types} returns this */ -proto.jspb.test.Int64Types.prototype.clearInt64Number = function() { +Int64Types.prototype.clearInt64Number = function() { return jspb.Message.setField(this, 3, undefined); }; @@ -8840,7 +8793,7 @@ proto.jspb.test.Int64Types.prototype.clearInt64Number = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.Int64Types.prototype.hasInt64Number = function() { +Int64Types.prototype.hasInt64Number = function() { return jspb.Message.getField(this, 3) != null; }; @@ -8861,8 +8814,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.TestMapFieldsNoBinary.toObject(opt_includeInstance, this); +TestMapFieldsNoBinary.prototype.toObject = function(opt_includeInstance) { + return TestMapFieldsNoBinary.toObject(opt_includeInstance, this); }; @@ -8875,7 +8828,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.toObject = function(opt_includeI * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestMapFieldsNoBinary.toObject = function(includeInstance, msg) { +TestMapFieldsNoBinary.toObject = function(includeInstance, msg) { var f, obj = { mapStringStringMap: (f = msg.getMapStringStringMap()) ? f.toObject(includeInstance, undefined) : [], mapStringInt32Map: (f = msg.getMapStringInt32Map()) ? f.toObject(includeInstance, undefined) : [], @@ -8883,12 +8836,12 @@ mapStringInt64Map: (f = msg.getMapStringInt64Map()) ? f.toObject(includeInstance mapStringBoolMap: (f = msg.getMapStringBoolMap()) ? f.toObject(includeInstance, undefined) : [], mapStringDoubleMap: (f = msg.getMapStringDoubleMap()) ? f.toObject(includeInstance, undefined) : [], mapStringEnumMap: (f = msg.getMapStringEnumMap()) ? f.toObject(includeInstance, undefined) : [], -mapStringMsgMap: (f = msg.getMapStringMsgMap()) ? f.toObject(includeInstance, proto.jspb.test.MapValueMessageNoBinary.toObject) : [], +mapStringMsgMap: (f = msg.getMapStringMsgMap()) ? f.toObject(includeInstance, MapValueMessageNoBinary.toObject) : [], mapInt32StringMap: (f = msg.getMapInt32StringMap()) ? f.toObject(includeInstance, undefined) : [], mapInt64StringMap: (f = msg.getMapInt64StringMap()) ? f.toObject(includeInstance, undefined) : [], mapBoolStringMap: (f = msg.getMapBoolStringMap()) ? f.toObject(includeInstance, undefined) : [], -testMapFields: (f = msg.getTestMapFields()) && proto.jspb.test.TestMapFieldsNoBinary.toObject(includeInstance, f), -mapStringTestmapfieldsMap: (f = msg.getMapStringTestmapfieldsMap()) ? f.toObject(includeInstance, proto.jspb.test.TestMapFieldsNoBinary.toObject) : [] +testMapFields: (f = msg.getTestMapFields()) && TestMapFieldsNoBinary.toObject(includeInstance, f), +mapStringTestmapfieldsMap: (f = msg.getMapStringTestmapfieldsMap()) ? f.toObject(includeInstance, TestMapFieldsNoBinary.toObject) : [] }; if (includeInstance) { @@ -8904,10 +8857,10 @@ mapStringTestmapfieldsMap: (f = msg.getMapStringTestmapfieldsMap()) ? f.toObject * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.TestMapFieldsNoBinary} */ -proto.jspb.test.TestMapFieldsNoBinary.deserializeBinary = function(bytes) { +TestMapFieldsNoBinary.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.TestMapFieldsNoBinary; - return proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader(msg, reader); + var msg = new TestMapFieldsNoBinary; + return TestMapFieldsNoBinary.deserializeBinaryFromReader(msg, reader); }; @@ -8918,7 +8871,7 @@ proto.jspb.test.TestMapFieldsNoBinary.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.TestMapFieldsNoBinary} */ -proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader = function(msg, reader) { +TestMapFieldsNoBinary.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -8964,7 +8917,7 @@ proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader = function(msg case 7: var value = msg.getMapStringMsgMap(); reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader, "", new proto.jspb.test.MapValueMessageNoBinary()); + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, MapValueMessageNoBinary.deserializeBinaryFromReader, "", new MapValueMessageNoBinary()); }); break; case 8: @@ -8986,14 +8939,14 @@ proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader = function(msg }); break; case 11: - var value = new proto.jspb.test.TestMapFieldsNoBinary; - reader.readMessage(value,proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader); + var value = new TestMapFieldsNoBinary; + reader.readMessage(value,TestMapFieldsNoBinary.deserializeBinaryFromReader); msg.setTestMapFields(value); break; case 12: var value = msg.getMapStringTestmapfieldsMap(); reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader, "", new proto.jspb.test.TestMapFieldsNoBinary()); + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, TestMapFieldsNoBinary.deserializeBinaryFromReader, "", new TestMapFieldsNoBinary()); }); break; default: @@ -9009,9 +8962,9 @@ proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader = function(msg * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.serializeBinary = function() { +TestMapFieldsNoBinary.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter(this, writer); + TestMapFieldsNoBinary.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9023,7 +8976,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter = function(message, writer) { +TestMapFieldsNoBinary.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = message.getMapStringStringMap(true); if (f && f.getLength() > 0) { @@ -9051,7 +9004,7 @@ proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter = function(message } f = message.getMapStringMsgMap(true); if (f && f.getLength() > 0) { - f.serializeBinary(7, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter); + f.serializeBinary(7, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, MapValueMessageNoBinary.serializeBinaryToWriter); } f = message.getMapInt32StringMap(true); if (f && f.getLength() > 0) { @@ -9070,12 +9023,12 @@ proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter = function(message writer.writeMessage( 11, f, - proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter + TestMapFieldsNoBinary.serializeBinaryToWriter ); } f = message.getMapStringTestmapfieldsMap(true); if (f && f.getLength() > 0) { - f.serializeBinary(12, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter); + f.serializeBinary(12, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, TestMapFieldsNoBinary.serializeBinaryToWriter); } }; @@ -9086,7 +9039,7 @@ proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter = function(message * empty, instead returning `undefined` * @return {!jspb.Map} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringStringMap = function(opt_noLazyCreate) { +TestMapFieldsNoBinary.prototype.getMapStringStringMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 1, opt_noLazyCreate, null)); @@ -9097,7 +9050,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringStringMap = function * Clears values from the map. The map will be non-null. * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringStringMap = function() { +TestMapFieldsNoBinary.prototype.clearMapStringStringMap = function() { this.getMapStringStringMap().clear(); return this; }; @@ -9109,7 +9062,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringStringMap = functi * empty, instead returning `undefined` * @return {!jspb.Map} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringInt32Map = function(opt_noLazyCreate) { +TestMapFieldsNoBinary.prototype.getMapStringInt32Map = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 2, opt_noLazyCreate, null)); @@ -9120,7 +9073,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringInt32Map = function( * Clears values from the map. The map will be non-null. * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringInt32Map = function() { +TestMapFieldsNoBinary.prototype.clearMapStringInt32Map = function() { this.getMapStringInt32Map().clear(); return this; }; @@ -9132,7 +9085,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringInt32Map = functio * empty, instead returning `undefined` * @return {!jspb.Map} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringInt64Map = function(opt_noLazyCreate) { +TestMapFieldsNoBinary.prototype.getMapStringInt64Map = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 3, opt_noLazyCreate, null)); @@ -9143,7 +9096,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringInt64Map = function( * Clears values from the map. The map will be non-null. * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringInt64Map = function() { +TestMapFieldsNoBinary.prototype.clearMapStringInt64Map = function() { this.getMapStringInt64Map().clear(); return this; }; @@ -9155,7 +9108,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringInt64Map = functio * empty, instead returning `undefined` * @return {!jspb.Map} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringBoolMap = function(opt_noLazyCreate) { +TestMapFieldsNoBinary.prototype.getMapStringBoolMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 4, opt_noLazyCreate, null)); @@ -9166,7 +9119,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringBoolMap = function(o * Clears values from the map. The map will be non-null. * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringBoolMap = function() { +TestMapFieldsNoBinary.prototype.clearMapStringBoolMap = function() { this.getMapStringBoolMap().clear(); return this; }; @@ -9178,7 +9131,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringBoolMap = function * empty, instead returning `undefined` * @return {!jspb.Map} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringDoubleMap = function(opt_noLazyCreate) { +TestMapFieldsNoBinary.prototype.getMapStringDoubleMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 5, opt_noLazyCreate, null)); @@ -9189,7 +9142,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringDoubleMap = function * Clears values from the map. The map will be non-null. * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringDoubleMap = function() { +TestMapFieldsNoBinary.prototype.clearMapStringDoubleMap = function() { this.getMapStringDoubleMap().clear(); return this; }; @@ -9201,7 +9154,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringDoubleMap = functi * empty, instead returning `undefined` * @return {!jspb.Map} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringEnumMap = function(opt_noLazyCreate) { +TestMapFieldsNoBinary.prototype.getMapStringEnumMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 6, opt_noLazyCreate, null)); @@ -9212,7 +9165,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringEnumMap = function(o * Clears values from the map. The map will be non-null. * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringEnumMap = function() { +TestMapFieldsNoBinary.prototype.clearMapStringEnumMap = function() { this.getMapStringEnumMap().clear(); return this; }; @@ -9224,10 +9177,10 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringEnumMap = function * empty, instead returning `undefined` * @return {!jspb.Map} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringMsgMap = function(opt_noLazyCreate) { +TestMapFieldsNoBinary.prototype.getMapStringMsgMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 7, opt_noLazyCreate, - proto.jspb.test.MapValueMessageNoBinary)); + MapValueMessageNoBinary)); }; @@ -9235,7 +9188,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringMsgMap = function(op * Clears values from the map. The map will be non-null. * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringMsgMap = function() { +TestMapFieldsNoBinary.prototype.clearMapStringMsgMap = function() { this.getMapStringMsgMap().clear(); return this; }; @@ -9247,7 +9200,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringMsgMap = function( * empty, instead returning `undefined` * @return {!jspb.Map} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapInt32StringMap = function(opt_noLazyCreate) { +TestMapFieldsNoBinary.prototype.getMapInt32StringMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 8, opt_noLazyCreate, null)); @@ -9258,7 +9211,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapInt32StringMap = function( * Clears values from the map. The map will be non-null. * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapInt32StringMap = function() { +TestMapFieldsNoBinary.prototype.clearMapInt32StringMap = function() { this.getMapInt32StringMap().clear(); return this; }; @@ -9270,7 +9223,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapInt32StringMap = functio * empty, instead returning `undefined` * @return {!jspb.Map} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapInt64StringMap = function(opt_noLazyCreate) { +TestMapFieldsNoBinary.prototype.getMapInt64StringMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 9, opt_noLazyCreate, null)); @@ -9281,7 +9234,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapInt64StringMap = function( * Clears values from the map. The map will be non-null. * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapInt64StringMap = function() { +TestMapFieldsNoBinary.prototype.clearMapInt64StringMap = function() { this.getMapInt64StringMap().clear(); return this; }; @@ -9293,7 +9246,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapInt64StringMap = functio * empty, instead returning `undefined` * @return {!jspb.Map} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapBoolStringMap = function(opt_noLazyCreate) { +TestMapFieldsNoBinary.prototype.getMapBoolStringMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 10, opt_noLazyCreate, null)); @@ -9304,7 +9257,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapBoolStringMap = function(o * Clears values from the map. The map will be non-null. * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapBoolStringMap = function() { +TestMapFieldsNoBinary.prototype.clearMapBoolStringMap = function() { this.getMapBoolStringMap().clear(); return this; }; @@ -9314,9 +9267,9 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapBoolStringMap = function * optional TestMapFieldsNoBinary test_map_fields = 11; * @return {?proto.jspb.test.TestMapFieldsNoBinary} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.getTestMapFields = function() { +TestMapFieldsNoBinary.prototype.getTestMapFields = function() { return /** @type{?proto.jspb.test.TestMapFieldsNoBinary} */ ( - jspb.Message.getWrapperField(this, proto.jspb.test.TestMapFieldsNoBinary, 11)); + jspb.Message.getWrapperField(this, TestMapFieldsNoBinary, 11)); }; @@ -9324,7 +9277,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.getTestMapFields = function() { * @param {?proto.jspb.test.TestMapFieldsNoBinary|undefined} value * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.setTestMapFields = function(value) { +TestMapFieldsNoBinary.prototype.setTestMapFields = function(value) { return jspb.Message.setWrapperField(this, 11, value); }; @@ -9333,7 +9286,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.setTestMapFields = function(valu * Clears the message field making it undefined. * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.clearTestMapFields = function() { +TestMapFieldsNoBinary.prototype.clearTestMapFields = function() { return this.setTestMapFields(undefined); }; @@ -9342,7 +9295,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.clearTestMapFields = function() * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.hasTestMapFields = function() { +TestMapFieldsNoBinary.prototype.hasTestMapFields = function() { return jspb.Message.getField(this, 11) != null; }; @@ -9353,10 +9306,10 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.hasTestMapFields = function() { * empty, instead returning `undefined` * @return {!jspb.Map} */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringTestmapfieldsMap = function(opt_noLazyCreate) { +TestMapFieldsNoBinary.prototype.getMapStringTestmapfieldsMap = function(opt_noLazyCreate) { return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 12, opt_noLazyCreate, - proto.jspb.test.TestMapFieldsNoBinary)); + TestMapFieldsNoBinary)); }; @@ -9364,7 +9317,7 @@ proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringTestmapfieldsMap = f * Clears values from the map. The map will be non-null. * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this */ -proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringTestmapfieldsMap = function() { +TestMapFieldsNoBinary.prototype.clearMapStringTestmapfieldsMap = function() { this.getMapStringTestmapfieldsMap().clear(); return this; }; @@ -9386,8 +9339,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.MapValueMessageNoBinary.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.MapValueMessageNoBinary.toObject(opt_includeInstance, this); +MapValueMessageNoBinary.prototype.toObject = function(opt_includeInstance) { + return MapValueMessageNoBinary.toObject(opt_includeInstance, this); }; @@ -9400,7 +9353,7 @@ proto.jspb.test.MapValueMessageNoBinary.prototype.toObject = function(opt_includ * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.MapValueMessageNoBinary.toObject = function(includeInstance, msg) { +MapValueMessageNoBinary.toObject = function(includeInstance, msg) { var f, obj = { foo: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; @@ -9418,10 +9371,10 @@ foo: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.MapValueMessageNoBinary} */ -proto.jspb.test.MapValueMessageNoBinary.deserializeBinary = function(bytes) { +MapValueMessageNoBinary.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.MapValueMessageNoBinary; - return proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader(msg, reader); + var msg = new MapValueMessageNoBinary; + return MapValueMessageNoBinary.deserializeBinaryFromReader(msg, reader); }; @@ -9432,7 +9385,7 @@ proto.jspb.test.MapValueMessageNoBinary.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.MapValueMessageNoBinary} */ -proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader = function(msg, reader) { +MapValueMessageNoBinary.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9456,9 +9409,9 @@ proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader = function(m * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.MapValueMessageNoBinary.prototype.serializeBinary = function() { +MapValueMessageNoBinary.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter(this, writer); + MapValueMessageNoBinary.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9470,7 +9423,7 @@ proto.jspb.test.MapValueMessageNoBinary.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter = function(message, writer) { +MapValueMessageNoBinary.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -9486,7 +9439,7 @@ proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter = function(messa * optional int32 foo = 1; * @return {number} */ -proto.jspb.test.MapValueMessageNoBinary.prototype.getFoo = function() { +MapValueMessageNoBinary.prototype.getFoo = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; @@ -9495,7 +9448,7 @@ proto.jspb.test.MapValueMessageNoBinary.prototype.getFoo = function() { * @param {number} value * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this */ -proto.jspb.test.MapValueMessageNoBinary.prototype.setFoo = function(value) { +MapValueMessageNoBinary.prototype.setFoo = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -9504,7 +9457,7 @@ proto.jspb.test.MapValueMessageNoBinary.prototype.setFoo = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this */ -proto.jspb.test.MapValueMessageNoBinary.prototype.clearFoo = function() { +MapValueMessageNoBinary.prototype.clearFoo = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -9513,7 +9466,7 @@ proto.jspb.test.MapValueMessageNoBinary.prototype.clearFoo = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.MapValueMessageNoBinary.prototype.hasFoo = function() { +MapValueMessageNoBinary.prototype.hasFoo = function() { return jspb.Message.getField(this, 1) != null; }; @@ -9534,8 +9487,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.Deeply.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.Deeply.toObject(opt_includeInstance, this); +Deeply.prototype.toObject = function(opt_includeInstance) { + return Deeply.toObject(opt_includeInstance, this); }; @@ -9548,7 +9501,7 @@ proto.jspb.test.Deeply.prototype.toObject = function(opt_includeInstance) { * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Deeply.toObject = function(includeInstance, msg) { +Deeply.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -9566,10 +9519,10 @@ proto.jspb.test.Deeply.toObject = function(includeInstance, msg) { * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.Deeply} */ -proto.jspb.test.Deeply.deserializeBinary = function(bytes) { +Deeply.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.Deeply; - return proto.jspb.test.Deeply.deserializeBinaryFromReader(msg, reader); + var msg = new Deeply; + return Deeply.deserializeBinaryFromReader(msg, reader); }; @@ -9580,7 +9533,7 @@ proto.jspb.test.Deeply.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.Deeply} */ -proto.jspb.test.Deeply.deserializeBinaryFromReader = function(msg, reader) { +Deeply.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9600,9 +9553,9 @@ proto.jspb.test.Deeply.deserializeBinaryFromReader = function(msg, reader) { * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.Deeply.prototype.serializeBinary = function() { +Deeply.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.Deeply.serializeBinaryToWriter(this, writer); + Deeply.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9614,7 +9567,7 @@ proto.jspb.test.Deeply.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Deeply.serializeBinaryToWriter = function(message, writer) { +Deeply.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; @@ -9635,8 +9588,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.Deeply.Nested.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.Deeply.Nested.toObject(opt_includeInstance, this); +Deeply.Nested.prototype.toObject = function(opt_includeInstance) { + return Deeply.Nested.toObject(opt_includeInstance, this); }; @@ -9649,7 +9602,7 @@ proto.jspb.test.Deeply.Nested.prototype.toObject = function(opt_includeInstance) * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Deeply.Nested.toObject = function(includeInstance, msg) { +Deeply.Nested.toObject = function(includeInstance, msg) { var f, obj = { }; @@ -9667,10 +9620,10 @@ proto.jspb.test.Deeply.Nested.toObject = function(includeInstance, msg) { * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.Deeply.Nested} */ -proto.jspb.test.Deeply.Nested.deserializeBinary = function(bytes) { +Deeply.Nested.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.Deeply.Nested; - return proto.jspb.test.Deeply.Nested.deserializeBinaryFromReader(msg, reader); + var msg = new Deeply.Nested; + return Deeply.Nested.deserializeBinaryFromReader(msg, reader); }; @@ -9681,7 +9634,7 @@ proto.jspb.test.Deeply.Nested.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.Deeply.Nested} */ -proto.jspb.test.Deeply.Nested.deserializeBinaryFromReader = function(msg, reader) { +Deeply.Nested.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9701,9 +9654,9 @@ proto.jspb.test.Deeply.Nested.deserializeBinaryFromReader = function(msg, reader * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.Deeply.Nested.prototype.serializeBinary = function() { +Deeply.Nested.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.Deeply.Nested.serializeBinaryToWriter(this, writer); + Deeply.Nested.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9715,7 +9668,7 @@ proto.jspb.test.Deeply.Nested.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Deeply.Nested.serializeBinaryToWriter = function(message, writer) { +Deeply.Nested.serializeBinaryToWriter = function(message, writer) { var f = undefined; }; @@ -9736,8 +9689,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -proto.jspb.test.Deeply.Nested.Message.prototype.toObject = function(opt_includeInstance) { - return proto.jspb.test.Deeply.Nested.Message.toObject(opt_includeInstance, this); +Deeply.Nested.Message.prototype.toObject = function(opt_includeInstance) { + return Deeply.Nested.Message.toObject(opt_includeInstance, this); }; @@ -9750,7 +9703,7 @@ proto.jspb.test.Deeply.Nested.Message.prototype.toObject = function(opt_includeI * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Deeply.Nested.Message.toObject = function(includeInstance, msg) { +Deeply.Nested.Message.toObject = function(includeInstance, msg) { var f, obj = { count: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; @@ -9768,10 +9721,10 @@ count: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f * @param {jspb.ByteSource} bytes The bytes to deserialize. * @return {!proto.jspb.test.Deeply.Nested.Message} */ -proto.jspb.test.Deeply.Nested.Message.deserializeBinary = function(bytes) { +Deeply.Nested.Message.deserializeBinary = function(bytes) { var reader = new jspb.BinaryReader(bytes); - var msg = new proto.jspb.test.Deeply.Nested.Message; - return proto.jspb.test.Deeply.Nested.Message.deserializeBinaryFromReader(msg, reader); + var msg = new Deeply.Nested.Message; + return Deeply.Nested.Message.deserializeBinaryFromReader(msg, reader); }; @@ -9782,7 +9735,7 @@ proto.jspb.test.Deeply.Nested.Message.deserializeBinary = function(bytes) { * @param {!jspb.BinaryReader} reader The BinaryReader to use. * @return {!proto.jspb.test.Deeply.Nested.Message} */ -proto.jspb.test.Deeply.Nested.Message.deserializeBinaryFromReader = function(msg, reader) { +Deeply.Nested.Message.deserializeBinaryFromReader = function(msg, reader) { while (reader.nextField()) { if (reader.isEndGroup()) { break; @@ -9806,9 +9759,9 @@ proto.jspb.test.Deeply.Nested.Message.deserializeBinaryFromReader = function(msg * Serializes the message to binary data (in protobuf wire format). * @return {!Uint8Array} */ -proto.jspb.test.Deeply.Nested.Message.prototype.serializeBinary = function() { +Deeply.Nested.Message.prototype.serializeBinary = function() { var writer = new jspb.BinaryWriter(); - proto.jspb.test.Deeply.Nested.Message.serializeBinaryToWriter(this, writer); + Deeply.Nested.Message.serializeBinaryToWriter(this, writer); return writer.getResultBuffer(); }; @@ -9820,7 +9773,7 @@ proto.jspb.test.Deeply.Nested.Message.prototype.serializeBinary = function() { * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ -proto.jspb.test.Deeply.Nested.Message.serializeBinaryToWriter = function(message, writer) { +Deeply.Nested.Message.serializeBinaryToWriter = function(message, writer) { var f = undefined; f = /** @type {number} */ (jspb.Message.getField(message, 1)); if (f != null) { @@ -9836,7 +9789,7 @@ proto.jspb.test.Deeply.Nested.Message.serializeBinaryToWriter = function(message * optional int32 count = 1; * @return {number} */ -proto.jspb.test.Deeply.Nested.Message.prototype.getCount = function() { +Deeply.Nested.Message.prototype.getCount = function() { return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); }; @@ -9845,7 +9798,7 @@ proto.jspb.test.Deeply.Nested.Message.prototype.getCount = function() { * @param {number} value * @return {!proto.jspb.test.Deeply.Nested.Message} returns this */ -proto.jspb.test.Deeply.Nested.Message.prototype.setCount = function(value) { +Deeply.Nested.Message.prototype.setCount = function(value) { return jspb.Message.setField(this, 1, value); }; @@ -9854,7 +9807,7 @@ proto.jspb.test.Deeply.Nested.Message.prototype.setCount = function(value) { * Clears the field making it undefined. * @return {!proto.jspb.test.Deeply.Nested.Message} returns this */ -proto.jspb.test.Deeply.Nested.Message.prototype.clearCount = function() { +Deeply.Nested.Message.prototype.clearCount = function() { return jspb.Message.setField(this, 1, undefined); }; @@ -9863,7 +9816,7 @@ proto.jspb.test.Deeply.Nested.Message.prototype.clearCount = function() { * Returns whether this field is set. * @return {boolean} */ -proto.jspb.test.Deeply.Nested.Message.prototype.hasCount = function() { +Deeply.Nested.Message.prototype.hasCount = function() { return jspb.Message.getField(this, 1) != null; }; @@ -9871,7 +9824,7 @@ proto.jspb.test.Deeply.Nested.Message.prototype.hasCount = function() { /** * @enum {number} */ -proto.jspb.test.OuterEnum = { +export const OuterEnum = { FOO: 1, BAR: 2 }; @@ -9879,7 +9832,7 @@ proto.jspb.test.OuterEnum = { /** * @enum {number} */ -proto.jspb.test.MapValueEnumNoBinary = { +export const MapValueEnumNoBinary = { MAP_VALUE_FOO_NOBINARY: 0, MAP_VALUE_BAR_NOBINARY: 1, MAP_VALUE_BAZ_NOBINARY: 2 @@ -9888,7 +9841,7 @@ proto.jspb.test.MapValueEnumNoBinary = { /** * @enum {number} */ -proto.jspb.test.TestAllowAliasEnum = { +export const TestAllowAliasEnum = { TEST_ALLOW_ALIAS_DEFAULT: 0, VALUE1: 1 }; @@ -9899,24 +9852,24 @@ proto.jspb.test.TestAllowAliasEnum = { * field named `simple1`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.simple1 = new jspb.ExtensionFieldInfo( +export const simple1 = new jspb.ExtensionFieldInfo( 105, {simple1: 0}, - proto.jspb.test.Simple1, + Simple1, /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - proto.jspb.test.Simple1.toObject), + Simple1.toObject), 0); -proto.jspb.test.HasExtensions.extensionsBinary[105] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.simple1, +HasExtensions.extensionsBinary[105] = new jspb.ExtensionFieldBinaryInfo( + simple1, jspb.BinaryReader.prototype.readMessage, jspb.BinaryWriter.prototype.writeMessage, - proto.jspb.test.Simple1.serializeBinaryToWriter, - proto.jspb.test.Simple1.deserializeBinaryFromReader, + Simple1.serializeBinaryToWriter, + Simple1.deserializeBinaryFromReader, false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.HasExtensions.extensions[105] = proto.jspb.test.simple1; +HasExtensions.extensions[105] = simple1; /** @@ -9924,7 +9877,7 @@ proto.jspb.test.HasExtensions.extensions[105] = proto.jspb.test.simple1; * field named `extendTestLastFieldBeforePivotField`. * @type {!jspb.ExtensionFieldInfo} */ -proto.jspb.test.extendTestLastFieldBeforePivotField = new jspb.ExtensionFieldInfo( +export const extendTestLastFieldBeforePivotField = new jspb.ExtensionFieldInfo( 101, {extendTestLastFieldBeforePivotField: 0}, null, @@ -9932,8 +9885,8 @@ proto.jspb.test.extendTestLastFieldBeforePivotField = new jspb.ExtensionFieldInf null), 0); -proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( - proto.jspb.test.extendTestLastFieldBeforePivotField, +TestLastFieldBeforePivot.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + extendTestLastFieldBeforePivotField, jspb.BinaryReader.prototype.readInt32, jspb.BinaryWriter.prototype.writeInt32, undefined, @@ -9941,52 +9894,18 @@ proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary[101] = new jspb.Extens false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -proto.jspb.test.TestLastFieldBeforePivot.extensions[101] = proto.jspb.test.extendTestLastFieldBeforePivotField; - -export const BooleanFields = proto.jspb.test.BooleanFields; -export const CloneExtension = proto.jspb.test.CloneExtension; -export const Complex = proto.jspb.test.Complex; -export const ComplexNested = proto.jspb.test.Complex.Nested; -export const Deeply = proto.jspb.test.Deeply; -export const DeeplyNested = proto.jspb.test.Deeply.Nested; -export const DeeplyNestedMessage = proto.jspb.test.Deeply.Nested.Message; -export const DefaultValues = proto.jspb.test.DefaultValues; -export const DefaultValuesEnum = proto.jspb.test.DefaultValues.Enum; -export const Empty = proto.jspb.test.Empty; -export const EnumContainer = proto.jspb.test.EnumContainer; -export const FloatingPointFields = proto.jspb.test.FloatingPointFields; -export const HasExtensions = proto.jspb.test.HasExtensions; -export const IndirectExtension = proto.jspb.test.IndirectExtension; -export const Int64Types = proto.jspb.test.Int64Types; -export const IsExtension = proto.jspb.test.IsExtension; -export const MapValueEnumNoBinary = proto.jspb.test.MapValueEnumNoBinary; -export const MapValueMessageNoBinary = proto.jspb.test.MapValueMessageNoBinary; -export const MineField = proto.jspb.test.MineField; -export const OptionalFields = proto.jspb.test.OptionalFields; -export const OptionalFieldsNested = proto.jspb.test.OptionalFields.Nested; -export const OuterEnum = proto.jspb.test.OuterEnum; -export const OuterMessage = proto.jspb.test.OuterMessage; -export const OuterMessageComplex = proto.jspb.test.OuterMessage.Complex; -export const Simple1 = proto.jspb.test.Simple1; -export const Simple2 = proto.jspb.test.Simple2; -export const SpecialCases = proto.jspb.test.SpecialCases; -export const TestAllowAliasEnum = proto.jspb.test.TestAllowAliasEnum; -export const TestClone = proto.jspb.test.TestClone; -export const TestCloneExtension = proto.jspb.test.TestCloneExtension; -export const TestEndsWithBytes = proto.jspb.test.TestEndsWithBytes; -export const TestGroup = proto.jspb.test.TestGroup; -export const TestGroupOptionalGroup = proto.jspb.test.TestGroup.OptionalGroup; -export const TestGroupRepeatedGroup = proto.jspb.test.TestGroup.RepeatedGroup; -export const TestGroupRequiredGroup = proto.jspb.test.TestGroup.RequiredGroup; -export const TestGroup1 = proto.jspb.test.TestGroup1; -export const TestLastFieldBeforePivot = proto.jspb.test.TestLastFieldBeforePivot; -export const TestMapFieldsNoBinary = proto.jspb.test.TestMapFieldsNoBinary; -export const TestMessageWithOneof = proto.jspb.test.TestMessageWithOneof; -export const TestMessageWithOneofDefaultOneofACase = proto.jspb.test.TestMessageWithOneof.DefaultOneofACase; -export const TestMessageWithOneofDefaultOneofBCase = proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase; -export const TestMessageWithOneofPartialOneofCase = proto.jspb.test.TestMessageWithOneof.PartialOneofCase; -export const TestMessageWithOneofRecursiveOneofCase = proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase; -export const TestReservedNames = proto.jspb.test.TestReservedNames; -export const TestReservedNamesExtension = proto.jspb.test.TestReservedNamesExtension; -export const extendTestLastFieldBeforePivotField = proto.jspb.test.extendTestLastFieldBeforePivotField; -export const simple1 = proto.jspb.test.simple1; +TestLastFieldBeforePivot.extensions[101] = extendTestLastFieldBeforePivotField; + +export const ComplexNested = Complex.Nested; +export const DeeplyNested = Deeply.Nested; +export const DeeplyNestedMessage = Deeply.Nested.Message; +export const DefaultValuesEnum = DefaultValues.Enum; +export const OptionalFieldsNested = OptionalFields.Nested; +export const OuterMessageComplex = OuterMessage.Complex; +export const TestGroupOptionalGroup = TestGroup.OptionalGroup; +export const TestGroupRepeatedGroup = TestGroup.RepeatedGroup; +export const TestGroupRequiredGroup = TestGroup.RequiredGroup; +export const TestMessageWithOneofDefaultOneofACase = TestMessageWithOneof.DefaultOneofACase; +export const TestMessageWithOneofDefaultOneofBCase = TestMessageWithOneof.DefaultOneofBCase; +export const TestMessageWithOneofPartialOneofCase = TestMessageWithOneof.PartialOneofCase; +export const TestMessageWithOneofRecursiveOneofCase = TestMessageWithOneof.RecursiveOneofCase; diff --git a/generator/js_generator.cc b/generator/js_generator.cc index fcbd3bbe..3a775189 100644 --- a/generator/js_generator.cc +++ b/generator/js_generator.cc @@ -180,11 +180,12 @@ std::string GetNestedMessageName(const Descriptor* descriptor) { return result; } -// Returns the path prefix for a message or enumeration that -// lives under the given file and containing type. -std::string GetPrefix(const GeneratorOptions& options, - const FileDescriptor* file_descriptor, - const Descriptor* containing_type) { +// Returns the fully-qualified path prefix for a message or enumeration that +// lives under the given file and containing type. Used for everything non-ES6, +// as well as specific ES6 uses where fully-qualified is needed. +std::string GetQualifiedPrefix(const GeneratorOptions& options, + const FileDescriptor* file_descriptor, + const Descriptor* containing_type) { std::string prefix = GetNamespace(options, file_descriptor) + GetNestedMessageName(containing_type); if (!prefix.empty()) { @@ -193,57 +194,157 @@ std::string GetPrefix(const GeneratorOptions& options, return prefix; } -// Returns the fully normalized JavaScript path prefix for the given +// Returns the import-relative path prefix for a message or enumeration that +// lives under the given file and containing type. Used for ES6 in most cases. +std::string GetRelativePrefix(const GeneratorOptions& options, + const FileDescriptor* file_descriptor, + const Descriptor* containing_type) { + std::string prefix = GetNestedMessageName(containing_type); + if (!prefix.empty()) { + prefix = prefix.substr(1, prefix.length() - 1); + prefix += "."; + } + return prefix; +} + +// Returns the normalized fully-qualified JavaScript path prefix for the given +// message descriptor. +std::string GetQualifiedMessagePathPrefix(const GeneratorOptions& options, + const Descriptor* descriptor) { + return GetQualifiedPrefix(options, descriptor->file(), + descriptor->containing_type()); +} + +// Returns the normalized import-relative JavaScript path prefix for the given // message descriptor. -std::string GetMessagePathPrefix(const GeneratorOptions& options, - const Descriptor* descriptor) { - return GetPrefix(options, descriptor->file(), descriptor->containing_type()); +std::string GetRelativeMessagePathPrefix(const GeneratorOptions& options, + const Descriptor* descriptor) { + return GetRelativePrefix(options, descriptor->file(), + descriptor->containing_type()); } -// Returns the fully normalized JavaScript path for the given +// Returns the normalized fully-qualified JavaScript path for the given // message descriptor. -std::string GetMessagePath(const GeneratorOptions& options, - const Descriptor* descriptor) { - return GetMessagePathPrefix(options, descriptor) + descriptor->name(); +std::string GetQualifiedMessagePath(const GeneratorOptions& options, + const Descriptor* descriptor) { + return GetQualifiedMessagePathPrefix(options, descriptor) + + descriptor->name(); +} + +// Returns the normalized import-relative JavaScript path for the given +// message descriptor. +std::string GetRelativeMessagePath(const GeneratorOptions& options, + const Descriptor* descriptor) { + return GetRelativeMessagePathPrefix(options, descriptor) + descriptor->name(); +} + +// Returns the normalized fully-qualified JavaScript path prefix for the given +// enumeration descriptor. +std::string GetQualifiedEnumPathPrefix(const GeneratorOptions& options, + const EnumDescriptor* enum_descriptor) { + return GetQualifiedPrefix(options, enum_descriptor->file(), + enum_descriptor->containing_type()); +} + +// Returns the normalized import-relative JavaScript path prefix for the given +// enumeration descriptor. +std::string GetRelativeEnumPathPrefix(const GeneratorOptions& options, + const EnumDescriptor* enum_descriptor) { + return GetRelativePrefix(options, enum_descriptor->file(), + enum_descriptor->containing_type()); } -// Returns the fully normalized JavaScript path prefix for the given +// Returns the normalized fully-qualified JavaScript path for the given // enumeration descriptor. -std::string GetEnumPathPrefix(const GeneratorOptions& options, - const EnumDescriptor* enum_descriptor) { - return GetPrefix(options, enum_descriptor->file(), - enum_descriptor->containing_type()); +std::string GetQualifiedEnumPath(const GeneratorOptions& options, + const EnumDescriptor* enum_descriptor) { + return GetQualifiedEnumPathPrefix(options, enum_descriptor) + + enum_descriptor->name(); } -// Returns the fully normalized JavaScript path for the given +// Returns the normalized import-relative JavaScript path for the given // enumeration descriptor. -std::string GetEnumPath(const GeneratorOptions& options, - const EnumDescriptor* enum_descriptor) { - return GetEnumPathPrefix(options, enum_descriptor) + enum_descriptor->name(); +std::string GetRelativeEnumPath(const GeneratorOptions& options, + const EnumDescriptor* enum_descriptor) { + return GetRelativeEnumPathPrefix(options, enum_descriptor) + + enum_descriptor->name(); } -std::string MaybeCrossFileRef(const GeneratorOptions& options, - const FileDescriptor* from_file, - const Descriptor* to_message) { +bool IsExportedMessage(const GeneratorOptions& options, + const Descriptor* desc) { + return options.import_style == GeneratorOptions::kImportEs6 && + GetNestedMessageName(desc->containing_type()).empty(); +} + +std::string LocalMessageRef(const GeneratorOptions& options, + const Descriptor* to_message) { + if (options.import_style == GeneratorOptions::kImportEs6) { + // in the same file for ES6, use the relative name directly + return GetRelativeMessagePath(options, to_message); + } else { + // Within a single file we use a full name. + return GetQualifiedMessagePath(options, to_message); + } +} + +std::string MaybeCrossFileMessageRef(const GeneratorOptions& options, + const FileDescriptor* from_file, + const Descriptor* to_message) { if ((options.import_style == GeneratorOptions::kImportCommonJs || options.import_style == GeneratorOptions::kImportCommonJsStrict || options.import_style == GeneratorOptions::kImportEs6) && from_file != to_message->file()) { - // Cross-file ref in CommonJS needs to use the module alias instead of - // the global name. - return ModuleAlias(to_message->file()->name()) + - GetNestedMessageName(to_message->containing_type()) + "." + - to_message->name(); + // Cross-file ref in CommonJS or ES6 needs to use the module alias instead + // of the global name. + return ModuleAlias(to_message->file()->name()) + "." + + GetRelativeMessagePath(options, to_message); + } else { + return LocalMessageRef(options, to_message); + } +} + +std::string LocalEnumRef(const GeneratorOptions& options, + const EnumDescriptor* to_enum) { + if (options.import_style == GeneratorOptions::kImportEs6) { + // in the same file for ES6, use the relative name directly + return GetRelativeEnumPath(options, to_enum); } else { // Within a single file we use a full name. - return GetMessagePath(options, to_message); + return GetQualifiedEnumPath(options, to_enum); + } +} + +bool IsExportedEnum(const GeneratorOptions& options, + const EnumDescriptor* desc) { + return options.import_style == GeneratorOptions::kImportEs6 && + GetNestedMessageName(desc->containing_type()).empty(); +} + +std::string MaybeCrossFileEnumRef(const GeneratorOptions& options, + const FileDescriptor* from_file, + const EnumDescriptor* to_enum) { + if ((options.import_style == GeneratorOptions::kImportCommonJs || + options.import_style == GeneratorOptions::kImportCommonJsStrict || + options.import_style == GeneratorOptions::kImportEs6) && + from_file != to_enum->file()) { + // Cross-file ref in CommonJS or ES6 needs to use the module alias instead + // of the global name. + return ModuleAlias(to_enum->file()->name()) + "." + + GetRelativeEnumPath(options, to_enum); + } else if (options.import_style == GeneratorOptions::kImportEs6) { + // in the same file for ES6, use the relative name directly + return GetRelativeEnumPath(options, to_enum); + } else { + // Within a single file we use a full name. + return GetQualifiedEnumPath(options, to_enum); } } std::string SubmessageTypeRef(const GeneratorOptions& options, const FieldDescriptor* field) { ABSL_CHECK(field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE); - return MaybeCrossFileRef(options, field->file(), field->message_type()); + return MaybeCrossFileMessageRef(options, field->file(), + field->message_type()); } // - Object field name: LOWER_UNDERSCORE -> LOWER_CAMEL, except for group fields @@ -893,11 +994,11 @@ std::string ProtoTypeName(const GeneratorOptions& options, case FieldDescriptor::TYPE_BYTES: return "bytes"; case FieldDescriptor::TYPE_GROUP: - return GetMessagePath(options, field->message_type()); + return GetQualifiedMessagePath(options, field->message_type()); case FieldDescriptor::TYPE_ENUM: - return GetEnumPath(options, field->enum_type()); + return GetQualifiedEnumPath(options, field->enum_type()); case FieldDescriptor::TYPE_MESSAGE: - return GetMessagePath(options, field->message_type()); + return GetQualifiedMessagePath(options, field->message_type()); default: return ""; } @@ -945,9 +1046,9 @@ std::string JSTypeName(const GeneratorOptions& options, case FieldDescriptor::CPPTYPE_STRING: return JSStringTypeName(options, field, bytes_mode); case FieldDescriptor::CPPTYPE_ENUM: - return GetEnumPath(options, field->enum_type()); + return GetQualifiedEnumPath(options, field->enum_type()); case FieldDescriptor::CPPTYPE_MESSAGE: - return GetMessagePath(options, field->message_type()); + return GetQualifiedMessagePath(options, field->message_type()); default: return ""; } @@ -1162,7 +1263,7 @@ static const char* kRepeatedFieldArrayName = ".repeatedFields_"; std::string RepeatedFieldsArrayName(const GeneratorOptions& options, const Descriptor* desc) { return HasRepeatedFields(options, desc) - ? (GetMessagePath(options, desc) + kRepeatedFieldArrayName) + ? (LocalMessageRef(options, desc) + kRepeatedFieldArrayName) : "null"; } @@ -1180,7 +1281,7 @@ static const char* kOneofGroupArrayName = ".oneofGroups_"; std::string OneofFieldsArrayName(const GeneratorOptions& options, const Descriptor* desc) { return HasOneofFields(desc) - ? (GetMessagePath(options, desc) + kOneofGroupArrayName) + ? (LocalMessageRef(options, desc) + kOneofGroupArrayName) : "null"; } @@ -1256,7 +1357,7 @@ std::string JSExtensionsObjectName(const GeneratorOptions& options, // TODO(haberman): fix this for the kImportCommonJs case. return "jspb.Message.messageSetExtensions"; } else { - return MaybeCrossFileRef(options, from_file, desc) + ".extensions"; + return MaybeCrossFileMessageRef(options, from_file, desc) + ".extensions"; } } @@ -1665,8 +1766,9 @@ void Generator::FindProvides(const GeneratorOptions& options, void FindProvidesForOneOfEnum(const GeneratorOptions& options, const OneofDescriptor* oneof, std::set* provided) { - std::string name = GetMessagePath(options, oneof->containing_type()) + "." + - JSOneofName(oneof) + "Case"; + std::string name = + GetQualifiedMessagePath(options, oneof->containing_type()) + "." + + JSOneofName(oneof) + "Case"; provided->insert(name); } @@ -1691,7 +1793,7 @@ void Generator::FindProvidesForMessage(const GeneratorOptions& options, return; } - std::string name = GetMessagePath(options, desc); + std::string name = GetQualifiedMessagePath(options, desc); provided->insert(name); for (int i = 0; i < desc->enum_type_count(); i++) { @@ -1708,7 +1810,7 @@ void Generator::FindProvidesForEnum(const GeneratorOptions& options, io::Printer* printer, const EnumDescriptor* enumdesc, std::set* provided) const { - std::string name = GetEnumPath(options, enumdesc); + std::string name = GetQualifiedEnumPath(options, enumdesc); provided->insert(name); } @@ -1751,6 +1853,9 @@ void Generator::GenerateProvides(const GeneratorOptions& options, namespaceObject.erase(0, 6); printer->Print("goog.exportSymbol('$name$', null, proto);\n", "name", namespaceObject); + } else if (options.import_style == GeneratorOptions::kImportEs6) { + // do nothing. we don't need `goog.*` behavior for ES6, and instead + // we'll `export ` things when we generate them. } else { printer->Print("goog.exportSymbol('$name$', null, global);\n", "name", *it); @@ -1818,7 +1923,8 @@ void Generator::GenerateRequiresForLibrary( } if (extension->containing_type()->full_name() != "google.protobuf.bridge.MessageSet") { - required.insert(GetMessagePath(options, extension->containing_type())); + required.insert( + GetQualifiedMessagePath(options, extension->containing_type())); } FindRequiresForField(options, extension, &required, &forwards); have_extensions = true; @@ -1929,13 +2035,13 @@ void Generator::FindRequiresForField(const GeneratorOptions& options, // dependencies, as per original codegen. !(field->is_extension() && field->extension_scope() == nullptr)) { if (options.add_require_for_enums) { - required->insert(GetEnumPath(options, field->enum_type())); + required->insert(GetQualifiedEnumPath(options, field->enum_type())); } else { - forwards->insert(GetEnumPath(options, field->enum_type())); + forwards->insert(GetQualifiedEnumPath(options, field->enum_type())); } } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { if (!IgnoreMessage(field->message_type())) { - required->insert(GetMessagePath(options, field->message_type())); + required->insert(GetQualifiedMessagePath(options, field->message_type())); } } } @@ -1945,7 +2051,8 @@ void Generator::FindRequiresForExtension( std::set* required, std::set* forwards) const { if (field->containing_type()->full_name() != "google.protobuf.bridge.MessageSet") { - required->insert(GetMessagePath(options, field->containing_type())); + required->insert( + GetQualifiedMessagePath(options, field->containing_type())); } FindRequiresForField(options, field, required, forwards); } @@ -2032,10 +2139,14 @@ void Generator::GenerateClassConstructor(const GeneratorOptions& options, " * valid.\n" " * @extends {jspb.Message}\n" " * @constructor\n" - " */\n" - "$classprefix$$classname$ = function(opt_data) {\n", - "classprefix", GetMessagePathPrefix(options, desc), "classname", - desc->name()); + " */\n"); + if (IsExportedMessage(options, desc)) { + printer->Print("export function $classname$(opt_data) {\n", "classname", + LocalMessageRef(options, desc)); + } else { + printer->Print("$classname$ = function(opt_data) {\n", "classname", + LocalMessageRef(options, desc)); + } printer->Annotate("classname", desc); std::string message_id = GetMessageId(desc); printer->Print( @@ -2057,9 +2168,10 @@ void Generator::GenerateClassConstructor(const GeneratorOptions& options, " * @public\n" " * @override\n" " */\n" - " $classname$.displayName = '$classname$';\n" + " $classname$.displayName = '$displayname$';\n" "}\n", - "classname", GetMessagePath(options, desc)); + "classname", LocalMessageRef(options, desc), "displayname", + GetQualifiedMessagePath(options, desc)); } void Generator::GenerateClassConstructorAndDeclareExtensionFieldInfo( @@ -2092,7 +2204,7 @@ void Generator::GenerateClassFieldInfo(const GeneratorOptions& options, " */\n" "$classname$$rptfieldarray$ = $rptfields$;\n" "\n", - "classname", GetMessagePath(options, desc), "rptfieldarray", + "classname", LocalMessageRef(options, desc), "rptfieldarray", kRepeatedFieldArrayName, "rptfields", RepeatedFieldNumberList(options, desc)); } @@ -2113,7 +2225,7 @@ void Generator::GenerateClassFieldInfo(const GeneratorOptions& options, " */\n" "$classname$$oneofgrouparray$ = $oneofgroups$;\n" "\n", - "classname", GetMessagePath(options, desc), "oneofgrouparray", + "classname", LocalMessageRef(options, desc), "oneofgrouparray", kOneofGroupArrayName, "oneofgroups", OneofGroupList(desc)); for (int i = 0; i < desc->oneof_decl_count(); i++) { @@ -2131,8 +2243,9 @@ void Generator::GenerateClassXid(const GeneratorOptions& options, printer->Print( "\n" "\n" - "$class$.prototype.messageXid = xid('$class$');\n", - "class", GetMessagePath(options, desc)); + "$class$.prototype.messageXid = xid('$xid$');\n", + "class", LocalMessageRef(options, desc), "xid", + GetQualifiedMessagePath(options, desc)); } void Generator::GenerateOneofCaseDefinition( @@ -2144,7 +2257,7 @@ void Generator::GenerateOneofCaseDefinition( " */\n" "$classname$.$oneof$Case = {\n" " $upcase$_NOT_SET: 0", - "classname", GetMessagePath(options, oneof->containing_type()), "oneof", + "classname", LocalMessageRef(options, oneof->containing_type()), "oneof", JSOneofName(oneof), "upcase", ToEnumCase(oneof->name())); for (int i = 0; i < oneof->field_count(); i++) { @@ -2165,14 +2278,15 @@ void Generator::GenerateOneofCaseDefinition( "};\n" "\n" "/**\n" - " * @return {$class$.$oneof$Case}\n" + " * @return {$type$.$oneof$Case}\n" " */\n" "$class$.prototype.get$oneof$Case = function() {\n" - " return /** @type {$class$.$oneof$Case} */(jspb.Message." + " return /** @type {$type$.$oneof$Case} */(jspb.Message." "computeOneofCase(this, $class$.oneofGroups_[$oneofindex$]));\n" "};\n" "\n", - "class", GetMessagePath(options, oneof->containing_type()), "oneof", + "type", GetQualifiedMessagePath(options, oneof->containing_type()), + "class", LocalMessageRef(options, oneof->containing_type()), "oneof", JSOneofName(oneof), "oneofindex", JSOneofIndex(oneof)); } @@ -2208,13 +2322,14 @@ void Generator::GenerateClassToObject(const GeneratorOptions& options, "include\n" " * the JSPB instance for transitional soy proto support:\n" " * http://goto/soy-param-migration\n" - " * @param {!$classname$} msg The msg instance to transform.\n" + " * @param {!$typename$} msg The msg instance to transform.\n" " * @return {!Object}\n" " * @suppress {unusedLocalVariables} f is only used for nested messages\n" " */\n" "$classname$.toObject = function(includeInstance, msg) {\n" " var f, obj = {", - "classname", GetMessagePath(options, desc)); + "classname", LocalMessageRef(options, desc), "typename", + GetQualifiedMessagePath(options, desc)); bool first = true; for (int i = 0; i < desc->field_count(); i++) { @@ -2246,7 +2361,7 @@ void Generator::GenerateClassToObject(const GeneratorOptions& options, " $extObject$, $class$.prototype.getExtension,\n" " includeInstance);\n", "extObject", JSExtensionsObjectName(options, desc->file(), desc), - "class", GetMessagePath(options, desc)); + "class", LocalMessageRef(options, desc)); } printer->Print( @@ -2257,8 +2372,7 @@ void Generator::GenerateClassToObject(const GeneratorOptions& options, "};\n" "}\n" "\n" - "\n", - "classname", GetMessagePath(options, desc)); + "\n"); } void Generator::GenerateFieldValueExpression(io::Printer* printer, @@ -2322,7 +2436,7 @@ void Generator::GenerateClassFieldToObject(const GeneratorOptions& options, std::string value_to_object; if (value_field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { value_to_object = - GetMessagePath(options, value_field->message_type()) + ".toObject"; + LocalMessageRef(options, value_field->message_type()) + ".toObject"; } else { value_to_object = "undefined"; } @@ -2382,7 +2496,8 @@ void Generator::GenerateObjectTypedef(const GeneratorOptions& options, const Descriptor* desc) const { // TODO(b/122687752): Consider renaming nested messages called ObjectFormat // to prevent collisions. - const std::string type_name = GetMessagePath(options, desc) + ".ObjectFormat"; + const std::string type_name = + LocalMessageRef(options, desc) + ".ObjectFormat"; printer->Print( "/**\n" @@ -2418,13 +2533,14 @@ void Generator::GenerateClassFromObject(const GeneratorOptions& options, printer->Print( "/**\n" " * Loads data from an object into a new instance of this proto.\n" - " * @param {!$classname$.ObjectFormat} obj\n" + " * @param {!$typename$.ObjectFormat} obj\n" " * The object representation of this proto to load the data from.\n" - " * @return {!$classname$}\n" + " * @return {!$typename$}\n" " */\n" "$classname$.fromObject = function(obj) {\n" " var msg = new $classname$();\n", - "classname", GetMessagePath(options, desc)); + "classname", LocalMessageRef(options, desc), "typename", + GetQualifiedMessagePath(options, desc)); for (int i = 0; i < desc->field_count(); i++) { const FieldDescriptor* field = desc->field(i); @@ -2453,7 +2569,7 @@ void Generator::GenerateClassFieldFromObject( "$fieldclass$.fromObject));\n", "name", JSObjectFieldName(options, field), "index", JSFieldIndex(field), "fieldclass", - GetMessagePath(options, value_field->message_type())); + LocalMessageRef(options, value_field->message_type())); } else { // `msg` is a newly-constructed message object that has not yet built any // map containers wrapping underlying arrays, so we can simply directly @@ -2538,7 +2654,7 @@ void GenerateBytesWrapper(const GeneratorOptions& options, io::Printer* printer, "\n", "fielddef", FieldDefinition(options, field), "comment", FieldComments(field, bytes_mode), "type", type, "class", - GetMessagePath(options, field->containing_type()), "name", + LocalMessageRef(options, field->containing_type()), "name", JSGetterName(options, field, bytes_mode), "list", field->is_repeated() ? "List" : "", "suffix", JSByteGetterSuffix(bytes_mode), "defname", @@ -2575,7 +2691,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, printer->Print( "$class$.prototype.$gettername$ = function(opt_noLazyCreate) {\n" " return /** @type {!jspb.Map<$keytype$,$valuetype$>} */ (\n", - "class", GetMessagePath(options, field->containing_type()), + "class", LocalMessageRef(options, field->containing_type()), "gettername", "get" + JSGetterName(options, field), "keytype", key_type, "valuetype", value_type); printer->Annotate("gettername", field); @@ -2587,7 +2703,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, printer->Print( ",\n" " $messageType$", - "messageType", GetMessagePath(options, value_field->message_type())); + "messageType", LocalMessageRef(options, value_field->message_type())); } else { printer->Print( ",\n" @@ -2624,7 +2740,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "};\n" "\n" "\n", - "class", GetMessagePath(options, field->containing_type()), + "class", LocalMessageRef(options, field->containing_type()), "gettername", "get" + JSGetterName(options, field), "type", JSFieldTypeAnnotation(options, field, /* is_setter_argument = */ false, @@ -2638,7 +2754,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, printer->Print( "/**\n" " * @param {$optionaltype$} value\n" - " * @return {!$class$} returns this\n" + " * @return {!$returntype$} returns this\n" "*/\n" "$class$.prototype.$settername$ = function(value) {\n" " return jspb.Message.set$oneoftag$$repeatedtag$WrapperField(", @@ -2647,7 +2763,9 @@ void Generator::GenerateClassField(const GeneratorOptions& options, /* is_setter_argument = */ true, /* force_present = */ false, /* singular_if_not_packed = */ false), - "class", GetMessagePath(options, field->containing_type()), + "class", LocalMessageRef(options, field->containing_type()), + "returntype", + GetQualifiedMessagePath(options, field->containing_type()), "settername", "set" + JSGetterName(options, field), "oneoftag", (InRealOneof(field) ? "Oneof" : ""), "repeatedtag", (field->is_repeated() ? "Repeated" : "")); @@ -2700,7 +2818,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, } printer->Print("$class$.prototype.$gettername$ = function() {\n", "class", - GetMessagePath(options, field->containing_type()), + LocalMessageRef(options, field->containing_type()), "gettername", "get" + JSGetterName(options, field)); printer->Annotate("gettername", field); @@ -2750,7 +2868,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, " * @param {$optionaltype$} value\n" " * @return {!$class$} returns this\n" " */\n", - "class", GetMessagePath(options, field->containing_type()), + "class", GetQualifiedMessagePath(options, field->containing_type()), "optionaltype", untyped ? "*" : JSFieldTypeAnnotation(options, field, @@ -2769,7 +2887,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "};\n" "\n" "\n", - "class", GetMessagePath(options, field->containing_type()), + "class", LocalMessageRef(options, field->containing_type()), "settername", "set" + JSGetterName(options, field), "typetag", JSTypeTag(field), "index", JSFieldIndex(field)); printer->Annotate("settername", field); @@ -2778,7 +2896,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, printer->Print( "$class$.prototype.$settername$ = function(value) {\n" " return jspb.Message.set$oneoftag$Field(this, $index$", - "class", GetMessagePath(options, field->containing_type()), + "class", LocalMessageRef(options, field->containing_type()), "settername", "set" + JSGetterName(options, field), "oneoftag", (InRealOneof(field) ? "Oneof" : ""), "index", JSFieldIndex(field)); printer->Annotate("settername", field); @@ -2800,7 +2918,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, " * Clears the value.\n" " * @return {!$class$} returns this\n" " */\n", - "class", GetMessagePath(options, field->containing_type())); + "class", GetQualifiedMessagePath(options, field->containing_type())); } if (field->is_repeated()) { @@ -2815,7 +2933,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, printer->Print( "/**\n" " * Clears values from the map. The map will be non-null.\n" - " * @return {!$class$} returns this\n" + " * @return {!$returntype$} returns this\n" " */\n" "$class$.prototype.$clearername$ = function() {\n" " this.$gettername$().clear();\n" @@ -2823,7 +2941,8 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "};\n" "\n" "\n", - "class", GetMessagePath(options, field->containing_type()), + "class", LocalMessageRef(options, field->containing_type()), + "returntype", GetQualifiedMessagePath(options, field->containing_type()), "clearername", "clear" + JSGetterName(options, field), "gettername", "get" + JSGetterName(options, field)); // clang-format on @@ -2836,7 +2955,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, printer->Print( "/**\n" " * $jsdoc$\n" - " * @return {!$class$} returns this\n" + " * @return {!$returntype$} returns this\n" " */\n" "$class$.prototype.$clearername$ = function() {\n" " return this.$settername$($clearedvalue$);\n" @@ -2846,7 +2965,8 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "jsdoc", field->is_repeated() ? "Clears the list making it empty but non-null." : "Clears the message field making it undefined.", - "class", GetMessagePath(options, field->containing_type()), + "class", LocalMessageRef(options, field->containing_type()), + "returntype", GetQualifiedMessagePath(options, field->containing_type()), "clearername", "clear" + JSGetterName(options, field), "settername", "set" + JSGetterName(options, field), "clearedvalue", (field->is_repeated() ? "[]" : "undefined")); @@ -2859,12 +2979,13 @@ void Generator::GenerateClassField(const GeneratorOptions& options, printer->Print( "/**\n" " * Clears the field making it undefined.\n" - " * @return {!$class$} returns this\n" + " * @return {!$returntype$} returns this\n" " */\n" "$class$.prototype.$clearername$ = function() {\n" " return jspb.Message.set$maybeoneof$Field(this, " "$index$$maybeoneofgroup$, ", - "class", GetMessagePath(options, field->containing_type()), + "class", LocalMessageRef(options, field->containing_type()), + "returntype", GetQualifiedMessagePath(options, field->containing_type()), "clearername", "clear" + JSGetterName(options, field), "maybeoneof", (InRealOneof(field) ? "Oneof" : ""), "maybeoneofgroup", (InRealOneof(field) @@ -2892,8 +3013,9 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "};\n" "\n" "\n", - "class", GetMessagePath(options, field->containing_type()), "hasername", - "has" + JSGetterName(options, field), "index", JSFieldIndex(field)); + "class", LocalMessageRef(options, field->containing_type()), + "hasername", "has" + JSGetterName(options, field), "index", + JSFieldIndex(field)); printer->Annotate("hasername", field); } } @@ -2906,12 +3028,13 @@ void Generator::GenerateRepeatedPrimitiveHelperMethods( "/**\n" " * @param {$optionaltype$} value\n" " * @param {number=} opt_index\n" - " * @return {!$class$} returns this\n" + " * @return {!$returntype$} returns this\n" " */\n" "$class$.prototype.$addername$ = function(value, opt_index) {\n" " return jspb.Message.addToRepeatedField(this, " "$index$", - "class", GetMessagePath(options, field->containing_type()), "addername", + "class", LocalMessageRef(options, field->containing_type()), + "returntype", GetQualifiedMessagePath(options, field->containing_type()), "addername", "add" + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list = */ true), "optionaltype", @@ -2942,14 +3065,16 @@ void Generator::GenerateRepeatedMessageHelperMethods( const FieldDescriptor* field) const { printer->Print( "/**\n" - " * @param {!$optionaltype$=} opt_value\n" + " * @param {$optionaltype$=} opt_value\n" " * @param {number=} opt_index\n" - " * @return {!$optionaltype$}\n" + " * @return {$optionaltype$}\n" " */\n" "$class$.prototype.$addername$ = function(opt_value, opt_index) {\n" " return jspb.Message.addTo$repeatedtag$WrapperField(", - "optionaltype", JSTypeName(options, field, BYTES_DEFAULT), "class", - GetMessagePath(options, field->containing_type()), "addername", + "optionaltype", + JSFieldTypeAnnotation(options, field, false, true, false, BYTES_DEFAULT, + true), + "class", LocalMessageRef(options, field->containing_type()), "addername", "add" + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list = */ true), "repeatedtag", (field->is_repeated() ? "Repeated" : "")); @@ -2962,7 +3087,7 @@ void Generator::GenerateRepeatedMessageHelperMethods( "\n", "index", JSFieldIndex(field), "oneofgroup", (InRealOneof(field) ? (", " + JSOneofArray(options, field)) : ""), "ctor", - GetMessagePath(options, field->message_type())); + LocalMessageRef(options, field->message_type())); } void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options, @@ -2988,7 +3113,7 @@ void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options, " */\n" "$class$.extensions = {};\n" "\n", - "class", GetMessagePath(options, desc)); + "class", LocalMessageRef(options, desc)); printer->Print( "\n" @@ -3009,7 +3134,7 @@ void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options, " */\n" "$class$.extensionsBinary = {};\n" "\n", - "class", GetMessagePath(options, desc)); + "class", LocalMessageRef(options, desc)); } } @@ -3023,25 +3148,26 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options, "/**\n" " * Deserializes binary data (in protobuf wire format).\n" " * @param {jspb.ByteSource} bytes The bytes to deserialize.\n" - " * @return {!$class$}\n" + " * @return {!$classtype$}\n" " */\n" - "$class$.deserializeBinary = function(bytes) {\n" + "$classname$.deserializeBinary = function(bytes) {\n" " var reader = new jspb.BinaryReader(bytes);\n" - " var msg = new $class$;\n" - " return $class$.deserializeBinaryFromReader(msg, reader);\n" + " var msg = new $classname$;\n" + " return $classname$.deserializeBinaryFromReader(msg, reader);\n" "};\n" "\n" "\n" "/**\n" " * Deserializes binary data (in protobuf wire format) from the\n" " * given reader into the given message object.\n" - " * @param {!$class$} msg The message object to deserialize into.\n" + " * @param {!$classtype$} msg The message object to deserialize into.\n" " * @param {!jspb.BinaryReader} reader The BinaryReader to use.\n" - " * @return {!$class$}\n" + " * @return {!$classtype$}\n" " */\n" - "$class$.deserializeBinaryFromReader = function(msg, reader) {\n" + "$classname$.deserializeBinaryFromReader = function(msg, reader) {\n" " while (reader.nextField()) {\n", - "class", GetMessagePath(options, desc)); + "classname", LocalMessageRef(options, desc), "classtype", + GetQualifiedMessagePath(options, desc)); printer->Print( " if (reader.isEndGroup()) {\n" " break;\n" @@ -3065,7 +3191,7 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options, " break;\n" " }\n", "extobj", JSExtensionsObjectName(options, desc->file(), desc), "class", - GetMessagePath(options, desc)); + LocalMessageRef(options, desc)); } else { printer->Print( " reader.skipField();\n" @@ -3103,14 +3229,14 @@ void Generator::GenerateClassDeserializeBinaryField( if (value_field->type() == FieldDescriptor::TYPE_MESSAGE) { printer->Print(", $messageType$.deserializeBinaryFromReader", "messageType", - GetMessagePath(options, value_field->message_type())); + LocalMessageRef(options, value_field->message_type())); } else { printer->Print(", null"); } printer->Print(", $defaultKey$", "defaultKey", JSFieldDefault(key_field)); if (value_field->type() == FieldDescriptor::TYPE_MESSAGE) { printer->Print(", new $messageType$()", "messageType", - GetMessagePath(options, value_field->message_type())); + LocalMessageRef(options, value_field->message_type())); } else { printer->Print(", $defaultValue$", "defaultValue", JSFieldDefault(value_field)); @@ -3180,9 +3306,9 @@ void Generator::GenerateClassSerializeBinary(const GeneratorOptions& options, " * Serializes the message to binary data (in protobuf wire format).\n" " * @return {!Uint8Array}\n" " */\n" - "$class$.prototype.serializeBinary = function() {\n" + "$classname$.prototype.serializeBinary = function() {\n" " var writer = new jspb.BinaryWriter();\n" - " $class$.serializeBinaryToWriter(this, writer);\n" + " $classname$.serializeBinaryToWriter(this, writer);\n" " return writer.getResultBuffer();\n" "};\n" "\n" @@ -3190,14 +3316,15 @@ void Generator::GenerateClassSerializeBinary(const GeneratorOptions& options, "/**\n" " * Serializes the given message to binary data (in protobuf wire\n" " * format), writing to the given BinaryWriter.\n" - " * @param {!$class$} message\n" + " * @param {!$classtype$} message\n" " * @param {!jspb.BinaryWriter} writer\n" " * @suppress {unusedLocalVariables} f is only used for nested messages\n" " */\n" - "$class$.serializeBinaryToWriter = function(message, " + "$classname$.serializeBinaryToWriter = function(message, " "writer) {\n" " var f = undefined;\n", - "class", GetMessagePath(options, desc)); + "classname", LocalMessageRef(options, desc), "classtype", + GetQualifiedMessagePath(options, desc)); for (int i = 0; i < desc->field_count(); i++) { if (!IgnoreField(desc->field(i))) { @@ -3210,7 +3337,7 @@ void Generator::GenerateClassSerializeBinary(const GeneratorOptions& options, " jspb.Message.serializeBinaryExtensions(message, writer,\n" " $extobj$Binary, $class$.prototype.getExtension);\n", "extobj", JSExtensionsObjectName(options, desc->file(), desc), "class", - GetMessagePath(options, desc)); + LocalMessageRef(options, desc)); } printer->Print( @@ -3303,7 +3430,7 @@ void Generator::GenerateClassSerializeBinaryField( if (value_field->type() == FieldDescriptor::TYPE_MESSAGE) { printer->Print(", $messageType$.serializeBinaryToWriter", "messageType", - GetMessagePath(options, value_field->message_type())); + LocalMessageRef(options, value_field->message_type())); } printer->Print(");\n"); @@ -3338,11 +3465,15 @@ void Generator::GenerateEnum(const GeneratorOptions& options, printer->Print( "/**\n" " * @enum {number}\n" - " */\n" - "$enumprefix$$name$ = {\n", - "enumprefix", GetEnumPathPrefix(options, enumdesc), "name", - enumdesc->name()); - printer->Annotate("name", enumdesc); + " */\n"); + if (IsExportedEnum(options, enumdesc)) { + printer->Print("export const $enumname$ = {\n", "enumname", + LocalEnumRef(options, enumdesc)); + } else { + printer->Print("$enumname$ = {\n", "enumname", + LocalEnumRef(options, enumdesc)); + } + printer->Annotate("enumname", enumdesc); std::set used_name; std::vector valid_index; @@ -3369,11 +3500,6 @@ void Generator::GenerateEnum(const GeneratorOptions& options, void Generator::GenerateExtension(const GeneratorOptions& options, io::Printer* printer, const FieldDescriptor* field) const { - std::string extension_scope = - (field->extension_scope() - ? GetMessagePath(options, field->extension_scope()) - : GetNamespace(options, field->file())); - const std::string extension_object_name = JSObjectFieldName(options, field); printer->Print( "\n" @@ -3381,14 +3507,26 @@ void Generator::GenerateExtension(const GeneratorOptions& options, " * A tuple of {field number, class constructor} for the extension\n" " * field named `$nameInComment$`.\n" " * @type {!jspb.ExtensionFieldInfo<$extensionType$>}\n" - " */\n" - "$class$.$name$ = new jspb.ExtensionFieldInfo(\n", - "nameInComment", extension_object_name, "name", extension_object_name, - "class", extension_scope, "extensionType", + " */\n", + "nameInComment", extension_object_name, "extensionType", JSFieldTypeAnnotation(options, field, /* is_setter_argument = */ false, /* force_present = */ true, /* singular_if_not_packed = */ false)); + + const Descriptor* scope_desc = field->extension_scope(); + std::string extension_scope = + (scope_desc ? MaybeCrossFileMessageRef(options, field->file(), scope_desc) + : GetNamespace(options, field->file())); + if (!scope_desc && options.import_style == GeneratorOptions::kImportEs6) { + extension_scope = ""; + printer->Print("export const $name$ = new jspb.ExtensionFieldInfo(\n", + "name", extension_object_name); + } else { + extension_scope += "."; + printer->Print("$class$$name$ = new jspb.ExtensionFieldInfo(\n", "class", + extension_scope, "name", extension_object_name); + } printer->Annotate("name", field); printer->Print( " $index$,\n" @@ -3398,7 +3536,8 @@ void Generator::GenerateExtension(const GeneratorOptions& options, "!Object} */ (\n" " $toObject$),\n" " $repeated$);\n", - "index", absl::StrCat(field->number()), "name", extension_object_name, "ctor", + "index", absl::StrCat(field->number()), "name", extension_object_name, + "ctor", (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE ? SubmessageTypeRef(options, field) : std::string("null")), @@ -3411,7 +3550,7 @@ void Generator::GenerateExtension(const GeneratorOptions& options, printer->Print( "\n" "$extendName$Binary[$index$] = new jspb.ExtensionFieldBinaryInfo(\n" - " $class$.$name$,\n" + " $class$$name$,\n" " $binaryReaderFn$,\n" " $binaryWriterFn$,\n" " $binaryMessageSerializeFn$,\n" @@ -3436,7 +3575,7 @@ void Generator::GenerateExtension(const GeneratorOptions& options, printer->Print( "// This registers the extension field with the extended class, so that\n" "// toObject() will function correctly.\n" - "$extendName$[$index$] = $class$.$name$;\n" + "$extendName$[$index$] = $class$$name$;\n" "\n", "extendName", JSExtensionsObjectName(options, field->file(), field->containing_type()), @@ -3469,7 +3608,7 @@ bool GeneratorOptions::ParseFromOptions( } else if (option.first == "error_on_name_conflict") { ABSL_LOG(WARNING) << "Ignoring error_on_name_conflict option, this " - "will be removed in a future release"; + "will be removed in a future release"; } else if (option.first == "output_dir") { output_dir = option.second; } else if (option.first == "namespace_prefix") { @@ -3642,7 +3781,6 @@ void Generator::GenerateFile(const GeneratorOptions& options, if ((options.import_style == GeneratorOptions::kImportCommonJs || options.import_style == GeneratorOptions::kImportCommonJsStrict || options.import_style == GeneratorOptions::kImportEs6)) { - if (options.import_style == GeneratorOptions::kImportEs6) { printer->Print("import * as jspb from 'google-protobuf';\n"); } else { @@ -3688,10 +3826,11 @@ void Generator::GenerateFile(const GeneratorOptions& options, } else { for (int i = 0; i < file->dependency_count(); i++) { const std::string& name = file->dependency(i)->name(); - printer->Print("var $alias$ = require('$file$');\n" - "goog.object.extend(proto, $alias$);\n", - "alias", ModuleAlias(name), "file", - GetRootPath(file->name(), name) + GetJSFilename(options, name)); + printer->Print( + "var $alias$ = require('$file$');\n" + "goog.object.extend(proto, $alias$);\n", + "alias", ModuleAlias(name), "file", + GetRootPath(file->name(), name) + GetJSFilename(options, name)); } } } @@ -3741,14 +3880,17 @@ void Generator::GenerateFile(const GeneratorOptions& options, for (std::set::iterator it = provided.begin(); it != provided.end(); ++it) { std::string fullname = *it; - std::string name = fullname.substr(package.length()); - - std::string::iterator iend = std::remove(name.begin(), name.end(), '.'); - name.resize(name.length()-(name.end()-iend)); - name.shrink_to_fit(); - - printer->Print("export const $name$ = $fullname$;\n", - "name", name, "fullname", fullname); + std::string localname = fullname.substr(package.length() + 1); + std::string exportedname = localname; + std::string::iterator iend = + std::remove(exportedname.begin(), exportedname.end(), '.'); + exportedname.resize(exportedname.length() - (exportedname.end() - iend)); + exportedname.shrink_to_fit(); + // when exported name == local name, it's top level and already exported + if (exportedname != localname) { + printer->Print("export const $exportedname$ = $localname$;\n", + "exportedname", exportedname, "localname", localname); + } } } @@ -3788,47 +3930,18 @@ const std::string DTS_INDENT = " "; void Generator::GenerateDTS(const GeneratorOptions& options, io::Printer* printer, const FileDescriptor* file) const { - std::string ns = GetNamespace(options, file); - printer->Print("declare namespace $ns$ {\n", "ns", ns); + printer->Print("import * as jspb from 'google-protobuf';\n\n"); + + // determine other imports - const std::string& indent = DTS_INDENT; - std::set exported; for (int i = 0; i < file->message_type_count(); i++) { auto desc = file->message_type(i); - GenerateMessageDTS(options, printer, desc, indent); - exported.insert(desc->name()); + GenerateMessageDTS(options, printer, desc, ""); } + for (int i = 0; i < file->enum_type_count(); i++) { auto enumdesc = file->enum_type(i); - GenerateEnumDTS(options, printer, enumdesc, indent); - exported.insert(enumdesc->name()); - } - - printer->Print("}\n"); - - if (!exported.empty()) { - for (auto name : exported) { - std::string fullname = ns + "." + name; - printer->Print( - "\ndeclare module \"goog:$fullname$ \" {\n" - "$indent$import $name$ = $fullname$;\n" - "$indent$export default $name$;\n" - "}\n", - "name", name, "fullname", fullname, "indent", indent); - } - - printer->Print("\n"); - for (auto name : exported) { - std::string fullname = ns + "." + name; - printer->Print("import $name$ = $fullname$;\n", "name", name, "fullname", - fullname); - } - printer->Print("\n"); - printer->Print("export {\n"); - for (auto name : exported) { - printer->Print("$indent$$name$,\n", "name", name, "indent", indent); - } - printer->Print("};\n"); + GenerateEnumDTS(options, printer, enumdesc, ""); } // Emit well-known type methods. @@ -3847,8 +3960,13 @@ void Generator::GenerateMessageDTS(const GeneratorOptions& options, return; } - printer->Print("$indent$export class $classname$ extends jspb.Message {\n", - "classname", desc->name(), "indent", indent); + std::string prefix = indent; + if (indent == "") { + prefix = "export "; + } + + printer->Print("$prefix$class $classname$ extends jspb.Message {\n", + "classname", desc->name(), "prefix", prefix); const std::string nested_indent = indent + DTS_INDENT; printer->Print("$indent$constructor(data?: any[] | null);\n", "indent", @@ -3856,28 +3974,23 @@ void Generator::GenerateMessageDTS(const GeneratorOptions& options, if (HasOneofFields(desc)) { for (int i = 0; i < desc->oneof_decl_count(); i++) { - GenerateOneofDTS(options, printer, desc->oneof_decl(i), nested_indent); + GenerateOneofMethodDTS(options, printer, desc->oneof_decl(i), + nested_indent); } } printer->Print( - "$indent$toObject(includeInstance?: boolean): GlobalObject;\n" + "$indent$toObject(includeInstance?: boolean): { [key: string]: unknown " + "};\n" "$indent$static toObject(includeInstance: boolean | undefined, msg: " - "$class$): GlobalObject;\n" + "$class$): { [key: string]: unknown };\n" "$indent$static deserializeBinary(bytes: jspb.ByteSource): $class$;\n" "$indent$static deserializeBinaryFromReader(msg: $class$, reader: " "jspb.BinaryReader): $class$;\n" "$indent$serializeBinary(): Uint8Array;\n" "$indent$static serializeBinaryToWriter(message: $class$, writer: " "jspb.BinaryWriter): void;\n", - "class", GetMessagePath(options, desc), "indent", nested_indent); - - for (int i = 0; i < desc->nested_type_count(); i++) { - GenerateMessageDTS(options, printer, desc->nested_type(i), nested_indent); - } - for (int i = 0; i < desc->enum_type_count(); i++) { - GenerateEnumDTS(options, printer, desc->enum_type(i), nested_indent); - } + "class", LocalMessageRef(options, desc), "indent", nested_indent); for (int i = 0; i < desc->field_count(); i++) { if (!IgnoreField(desc->field(i))) { @@ -3886,20 +3999,53 @@ void Generator::GenerateMessageDTS(const GeneratorOptions& options, } printer->Print("$indent$}\n\n", "indent", indent); + + bool has_subtypes = false; + if (HasOneofFields(desc)) { + for (int i = 0; i < desc->oneof_decl_count(); i++) { + has_subtypes = has_subtypes || !IgnoreOneof(desc->oneof_decl(i)); + } + } + for (int i = 0; i < desc->nested_type_count(); i++) { + has_subtypes = has_subtypes || !IgnoreMessage(desc->nested_type(i)); + } + for (int i = 0; i < desc->enum_type_count(); i++) { + has_subtypes = true; + } + + if (has_subtypes) { + printer->Print("$prefix$namespace $classname$ {\n", "prefix", prefix, + "classname", desc->name()); + if (HasOneofFields(desc)) { + for (int i = 0; i < desc->oneof_decl_count(); i++) { + GenerateOneofEnumDTS(options, printer, desc->oneof_decl(i), + nested_indent); + } + } + + for (int i = 0; i < desc->nested_type_count(); i++) { + GenerateMessageDTS(options, printer, desc->nested_type(i), nested_indent); + } + for (int i = 0; i < desc->enum_type_count(); i++) { + GenerateEnumDTS(options, printer, desc->enum_type(i), nested_indent); + } + printer->Print("$indent$}\n\n", "indent", indent); + } } -void Generator::GenerateOneofDTS(const GeneratorOptions& options, - io::Printer* printer, - const OneofDescriptor* oneof, - const std::string& indent) const { +void Generator::GenerateOneofEnumDTS(const GeneratorOptions& options, + io::Printer* printer, + const OneofDescriptor* oneof, + const std::string& indent) const { if (IgnoreOneof(oneof)) { return; } - printer->Print("$indent$enum $oneof$Case = {\n", "oneof", JSOneofName(oneof), + + printer->Print("$indent$enum $oneof$Case {\n", "oneof", JSOneofName(oneof), "indent", indent); const std::string nested_indent = indent + DTS_INDENT; - printer->Print("$indent$$upcase$_NOT_SET: 0,\n", "upcase", + printer->Print("$indent$$upcase$_NOT_SET = 0,\n", "upcase", ToEnumCase(oneof->name()), "indent", nested_indent); for (int i = 0; i < oneof->field_count(); i++) { @@ -3907,31 +4053,66 @@ void Generator::GenerateOneofDTS(const GeneratorOptions& options, if (IgnoreField(field)) { continue; } - printer->Print("$indent$$upcase$: $number$,\n", "upcase", + printer->Print("$indent$$upcase$ = $number$,\n", "upcase", ToEnumCase(field->name()), "number", JSFieldIndex(field), "indent", nested_indent); } - printer->Print("$indent$};\n", "indent", indent); + printer->Print("$indent$}\n", "indent", indent); +} + +void Generator::GenerateOneofMethodDTS(const GeneratorOptions& options, + io::Printer* printer, + const OneofDescriptor* oneof, + const std::string& indent) const { + if (IgnoreOneof(oneof)) { + return; + } + printer->Print("$indent$get$oneof$Case(): $class$.$oneof$Case;\n", "class", - GetMessagePath(options, oneof->containing_type()), "oneof", + LocalMessageRef(options, oneof->containing_type()), "oneof", JSOneofName(oneof), "indent", indent); } +std::string DTSTypeName(const GeneratorOptions& options, + const FieldDescriptor* field, BytesMode bytes_mode) { + switch (field->cpp_type()) { + case FieldDescriptor::CPPTYPE_BOOL: + return "boolean"; + case FieldDescriptor::CPPTYPE_INT32: + case FieldDescriptor::CPPTYPE_INT64: + case FieldDescriptor::CPPTYPE_UINT32: + case FieldDescriptor::CPPTYPE_UINT64: + return JSIntegerTypeName(field); + case FieldDescriptor::CPPTYPE_FLOAT: + case FieldDescriptor::CPPTYPE_DOUBLE: + return "number"; + case FieldDescriptor::CPPTYPE_STRING: + return JSStringTypeName(options, field, bytes_mode); + case FieldDescriptor::CPPTYPE_ENUM: + return MaybeCrossFileEnumRef(options, field->file(), field->enum_type()); + case FieldDescriptor::CPPTYPE_MESSAGE: + return MaybeCrossFileMessageRef(options, field->file(), + field->message_type()); + default: + return ""; + } +} + std::string DTSFieldType(const GeneratorOptions& options, const FieldDescriptor* field, BytesMode bytes_mode = BYTES_DEFAULT, bool force_singular = false) { - std::string jstype = JSTypeName(options, field, bytes_mode); + std::string dtstype = DTSTypeName(options, field, bytes_mode); if (!force_singular && field->is_repeated()) { if (field->type() == FieldDescriptor::TYPE_BYTES && bytes_mode == BYTES_DEFAULT) { - jstype = "Uint8Array[] | string[]"; + dtstype = "Uint8Array[] | string[]"; } else { - jstype += "[]"; + dtstype += "[]"; } } - return jstype; + return dtstype; } std::string DTSFieldReturnType(const GeneratorOptions& options, @@ -3965,7 +4146,6 @@ void Generator::GenerateFieldDTS(const GeneratorOptions& options, "$indent$$gettername$(noLazyCreate?: boolean): " "jspb.Map<$keytype$,$valuetype$> " "| undefined;\n", - "class", GetMessagePath(options, field->containing_type()), "gettername", "get" + JSGetterName(options, field), "keytype", DTSFieldType(options, MapFieldKey(field)), "valuetype", DTSFieldType(options, MapFieldValue(field)), "indent", indent); @@ -3976,7 +4156,7 @@ void Generator::GenerateFieldDTS(const GeneratorOptions& options, printer->Print("$indent$$settername$(value: $optionaltype$): $class$;\n", "settername", "set" + JSGetterName(options, field), "optionaltype", DTSFieldSetterType(options, field), "class", - GetMessagePath(options, field->containing_type()), "indent", + LocalMessageRef(options, field->containing_type()), "indent", indent); if (field->is_repeated()) { printer->Print( @@ -3985,8 +4165,10 @@ void Generator::GenerateFieldDTS(const GeneratorOptions& options, "addername", "add" + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list */ true), - "optionaltype", JSTypeName(options, field, BYTES_DEFAULT), "indent", - indent); + "optionaltype", + DTSFieldType(options, field, BYTES_DEFAULT, + /* force_singular */ true), + "indent", indent); } } else { BytesMode bytes_mode = @@ -4010,7 +4192,7 @@ void Generator::GenerateFieldDTS(const GeneratorOptions& options, printer->Print("$indent$$settername$(value: $optionaltype$): $class$;\n", "settername", "set" + JSGetterName(options, field), "optionaltype", DTSFieldSetterType(options, field), "class", - GetMessagePath(options, field->containing_type()), "indent", + LocalMessageRef(options, field->containing_type()), "indent", indent); if (field->is_repeated()) { @@ -4021,7 +4203,7 @@ void Generator::GenerateFieldDTS(const GeneratorOptions& options, "add" + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list = */ true), "optionaltype", DTSFieldType(options, field, BYTES_DEFAULT, true), - "class", GetMessagePath(options, field->containing_type()), "indent", + "class", LocalMessageRef(options, field->containing_type()), "indent", indent); } } @@ -4032,7 +4214,7 @@ void Generator::GenerateFieldDTS(const GeneratorOptions& options, HasFieldPresence(options, field)) { printer->Print("$indent$$clearername$(): $class$;\n", "clearername", "clear" + JSGetterName(options, field), "class", - GetMessagePath(options, field->containing_type()), "indent", + LocalMessageRef(options, field->containing_type()), "indent", indent); } @@ -4046,7 +4228,12 @@ void Generator::GenerateEnumDTS(const GeneratorOptions& options, io::Printer* printer, const EnumDescriptor* enumdesc, const std::string& indent) const { - printer->Print("$indent$enum $name$ {\n", "indent", indent, "name", + std::string prefix = indent; + if (indent == "") { + prefix = "export "; + } + + printer->Print("$prefix$enum $name$ {\n", "prefix", prefix, "name", enumdesc->name()); std::set used_name; diff --git a/generator/js_generator.h b/generator/js_generator.h index 588d7e0e..49231b46 100644 --- a/generator/js_generator.h +++ b/generator/js_generator.h @@ -243,9 +243,13 @@ class Generator : public CodeGenerator { void GenerateMessageDTS(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc, const std::string& indent) const; - void GenerateOneofDTS(const GeneratorOptions& options, io::Printer* printer, - const OneofDescriptor* oneof, - const std::string& indent) const; + void GenerateOneofMethodDTS(const GeneratorOptions& options, + io::Printer* printer, + const OneofDescriptor* oneof, + const std::string& indent) const; + void GenerateOneofEnumDTS(const GeneratorOptions& options, + io::Printer* printer, const OneofDescriptor* oneof, + const std::string& indent) const; void GenerateFieldDTS(const GeneratorOptions& options, io::Printer* printer, const FieldDescriptor* field, const std::string& indent) const; diff --git a/generator/well_known_types_embed.cc b/generator/well_known_types_embed.cc index 5d433dd7..6feabcff 100644 --- a/generator/well_known_types_embed.cc +++ b/generator/well_known_types_embed.cc @@ -87,14 +87,66 @@ struct FileToc well_known_types_js[] = { " return null;\n" " }\n" "};\n", - "declare namespace proto.google.protobuf {\n" - " export class Any {\n" - " getTypeName(): string;\n" - " pack(serialized: Uint8Array, name: string, typeUrlPrefix?: string): " - "void;\n" - " unpack(deserialize: (Uint8Array) => T, name: string): T | null;\n" + "/* This code will be inserted into generated ES6 code for\n" + " * google/protobuf/any.proto. */\n" + "\n" + "/**\n" + " * Returns the type name contained in this instance, if any.\n" + " * @return {string|undefined}\n" + " */\n" + "Any.prototype.getTypeName = function() {\n" + " return this.getTypeUrl().split('/').pop();\n" + "};\n" + "\n" + "\n" + "/**\n" + " * Packs the given message instance into this Any.\n" + " * For binary format usage only.\n" + " * @param {!Uint8Array} serialized The serialized data to pack.\n" + " * @param {string} name The type name of this message object.\n" + " * @param {string=} opt_typeUrlPrefix the type URL prefix.\n" + " */\n" + "Any.prototype.pack = function(serialized, name, opt_typeUrlPrefix) " + "{\n" + " if (!opt_typeUrlPrefix) {\n" + " opt_typeUrlPrefix = 'type.googleapis.com/';\n" + " }\n" + "\n" + " if (opt_typeUrlPrefix.substr(-1) != '/') {\n" + " this.setTypeUrl(opt_typeUrlPrefix + '/' + name);\n" + " } else {\n" + " this.setTypeUrl(opt_typeUrlPrefix + name);\n" + " }\n" + "\n" + " this.setValue(serialized);\n" + "};\n" + "\n" + "\n" + "/**\n" + " * @template T\n" + " * Unpacks this Any into the given message object.\n" + " * @param {function(Uint8Array):T} deserialize Function that will " + "deserialize\n" + " * the binary data properly.\n" + " * @param {string} name The expected type name of this message object.\n" + " * @return {?T} If the name matched the expected name, returns the " + "deserialized\n" + " * object, otherwise returns null.\n" + " */\n" + "Any.prototype.unpack = function(deserialize, name) " + "{\n" + " if (this.getTypeName() == name) {\n" + " return deserialize(this.getValue_asU8());\n" + " } else {\n" + " return null;\n" " }\n" - "};\n"}, + "};\n", + "export class Any {\n" + " getTypeName(): string;\n" + " pack(serialized: Uint8Array, name: string, typeUrlPrefix?: string): " + "void;\n" + " unpack(deserialize: (Uint8Array) => T, name: string): T | null;\n" + "}\n"}, {"timestamp.js", "/* This code will be inserted into generated code for\n" " * google/protobuf/timestamp.proto. */\n" @@ -132,13 +184,47 @@ struct FileToc well_known_types_js[] = { " timestamp.fromDate(value);\n" " return timestamp;\n" "};\n", - "declare namespace proto.google.protobuf {\n" - " export class Timestamp {\n" - " toDate(): Date;\n" - " fromDate(value: Date): void;\n" - " static fromDate(value: Date): proto.google.protobuf.Timestamp;\n" - " }\n" - "};\n"}, + "/* This code will be inserted into generated ES6 code for\n" + " * google/protobuf/timestamp.proto. */\n" + "\n" + "/**\n" + " * Returns a JavaScript 'Date' object corresponding to this Timestamp.\n" + " * @return {!Date}\n" + " */\n" + "Timestamp.prototype.toDate = function() {\n" + " var seconds = this.getSeconds();\n" + " var nanos = this.getNanos();\n" + "\n" + " return new Date((seconds * 1000) + (nanos / 1000000));\n" + "};\n" + "\n" + "\n" + "/**\n" + " * Sets the value of this Timestamp object to be the given Date.\n" + " * @param {!Date} value The value to set.\n" + " */\n" + "Timestamp.prototype.fromDate = function(value) {\n" + " this.setSeconds(Math.floor(value.getTime() / 1000));\n" + " this.setNanos(value.getMilliseconds() * 1000000);\n" + "};\n" + "\n" + "\n" + "/**\n" + " * Factory method that returns a Timestamp object with value equal to\n" + " * the given Date.\n" + " * @param {!Date} value The value to set.\n" + " * @return {!proto.google.protobuf.Timestamp}\n" + " */\n" + "Timestamp.fromDate = function(value) {\n" + " var timestamp = new Timestamp();\n" + " timestamp.fromDate(value);\n" + " return timestamp;\n" + "};\n", + "export class Timestamp {\n" + " toDate(): Date;\n" + " fromDate(value: Date): void;\n" + " static fromDate(value: Date): Timestamp;\n" + "}"}, {"struct.js", "/* This code will be inserted into generated code for\n" " * google/protobuf/struct.proto. */\n" @@ -280,27 +366,161 @@ struct FileToc well_known_types_js[] = { "\n" " return ret;\n" "};\n", - "declare namespace proto.google.protobuf {\n" - " export type JavaScriptValue = " - "null|number|string|boolean|JavaScriptValue[]|{ [field: string]: " - "JavaScriptValue }};\n" - " export class Value {\n" - " toJavaScript(): proto.google.protobuf.JavaScriptValue;\n" - " static fromJavaScript(value: proto.google.protobuf.JavaScriptValue): " - "proto.google.protobuf.Value;\n" + "/* This code will be inserted into generated ES6 code for\n" + " * google/protobuf/struct.proto. */\n" + "\n" + "/**\n" + " * Typedef representing plain JavaScript values that can go into a\n" + " * Struct.\n" + " * @typedef {null|number|string|boolean|Array|Object}\n" + " */\n" + "JavaScriptValue;\n" + "\n" + "\n" + "/**\n" + " * Converts this Value object to a plain JavaScript value.\n" + " * @return {?proto.google.protobuf.JavaScriptValue} a plain JavaScript\n" + " * value representing this Struct.\n" + " */\n" + "Value.prototype.toJavaScript = function() {\n" + " var kindCase = Value.KindCase;\n" + " switch (this.getKindCase()) {\n" + " case kindCase.NULL_VALUE:\n" + " return null;\n" + " case kindCase.NUMBER_VALUE:\n" + " return this.getNumberValue();\n" + " case kindCase.STRING_VALUE:\n" + " return this.getStringValue();\n" + " case kindCase.BOOL_VALUE:\n" + " return this.getBoolValue();\n" + " case kindCase.STRUCT_VALUE:\n" + " return this.getStructValue().toJavaScript();\n" + " case kindCase.LIST_VALUE:\n" + " return this.getListValue().toJavaScript();\n" + " default:\n" + " throw new Error('Unexpected struct type');\n" " }\n" - " export class ListValue {\n" - " toJavaScript(): proto.google.protobuf.JavaScriptValue[];\n" - " static fromJavaScript(value: " - "proto.google.protobuf.JavaScriptValue[]): " - "proto.google.protobuf.ListValue;\n" + "};\n" + "\n" + "\n" + "/**\n" + " * Converts this JavaScript value to a new Value proto.\n" + " * @param {!JavaScriptValue} value The value to\n" + " * convert.\n" + " * @return {!proto.google.protobuf.Value} The newly constructed value.\n" + " */\n" + "Value.fromJavaScript = function(value) {\n" + " var ret = new Value();\n" + " switch (goog.typeOf(value)) {\n" + " case 'string':\n" + " ret.setStringValue(/** @type {string} */ (value));\n" + " break;\n" + " case 'number':\n" + " ret.setNumberValue(/** @type {number} */ (value));\n" + " break;\n" + " case 'boolean':\n" + " ret.setBoolValue(/** @type {boolean} */ (value));\n" + " break;\n" + " case 'null':\n" + " ret.setNullValue(NullValue.NULL_VALUE);\n" + " break;\n" + " case 'array':\n" + " ret.setListValue(ListValue.fromJavaScript(\n" + " /** @type{!Array} */ (value)));\n" + " break;\n" + " case 'object':\n" + " ret.setStructValue(Struct.fromJavaScript(\n" + " /** @type{!Object} */ (value)));\n" + " break;\n" + " default:\n" + " throw new Error('Unexpected struct type.');\n" " }\n" - " export class Struct {\n" - " toJavaScript(): { [field: string]: " - "proto.google.protobuf.JavaScriptValue };\n" - " static fromJavaScript(value: { [field: string]: " - "proto.google.protobuf.JavaScriptValue }): proto.google.protobuf.Struct;\n" + "\n" + " return ret;\n" + "};\n" + "\n" + "\n" + "/**\n" + " * Converts this ListValue object to a plain JavaScript array.\n" + " * @return {!Array} a plain JavaScript array representing this List.\n" + " */\n" + "ListValue.prototype.toJavaScript = function() {\n" + " var ret = [];\n" + " var values = this.getValuesList();\n" + "\n" + " for (var i = 0; i < values.length; i++) {\n" + " ret[i] = values[i].toJavaScript();\n" + " }\n" + "\n" + " return ret;\n" + "};\n" + "\n" + "\n" + "/**\n" + " * Constructs a ListValue protobuf from this plain JavaScript array.\n" + " * @param {!Array} array a plain JavaScript array\n" + " * @return {proto.google.protobuf.ListValue} a new ListValue object\n" + " */\n" + "ListValue.fromJavaScript = function(array) {\n" + " var ret = new ListValue();\n" + "\n" + " for (var i = 0; i < array.length; i++) {\n" + " " + "ret.addValues(Value.fromJavaScript(array[i]));\n" " }\n" - "};\n"}, - {NULL, NULL} // Terminate the list. + "\n" + " return ret;\n" + "};\n" + "\n" + "\n" + "/**\n" + " * Converts this Struct object to a plain JavaScript object.\n" + " * @return {!Object} a " + "plain\n" + " * JavaScript object representing this Struct.\n" + " */\n" + "Struct.prototype.toJavaScript = function() {\n" + " var ret = {};\n" + "\n" + " this.getFieldsMap().forEach(function(value, key) {\n" + " ret[key] = value.toJavaScript();\n" + " });\n" + "\n" + " return ret;\n" + "};\n" + "\n" + "\n" + "/**\n" + " * Constructs a Struct protobuf from this plain JavaScript object.\n" + " * @param {!Object} obj a plain JavaScript object\n" + " * @return {proto.google.protobuf.Struct} a new Struct object\n" + " */\n" + "Struct.fromJavaScript = function(obj) {\n" + " var ret = new Struct();\n" + " var map = ret.getFieldsMap();\n" + "\n" + " for (var property in obj) {\n" + " var val = obj[property];\n" + " map.set(property, Value.fromJavaScript(val));\n" + " }\n" + "\n" + " return ret;\n" + "};\n", + "export type JavaScriptValue = " + "null|number|string|boolean|JavaScriptValue[]|{ [field: string]: " + "JavaScriptValue }};\n" + "export class Value {\n" + " toJavaScript(): JavaScriptValue;\n" + " static fromJavaScript(value: JavaScriptValue): Value;\n" + "}\n" + "export class ListValue {\n" + " toJavaScript(): JavaScriptValue[];\n" + " static fromJavaScript(value: JavaScriptValue[]): ListValue;\n" + "}\n" + "export class Struct {\n" + " toJavaScript(): { [field: string]: JavaScriptValue };\n" + " static fromJavaScript(value: { [field: string]: JavaScriptValue }): " + "Struct;\n" + "}\n"}, + {NULL, NULL, NULL, NULL} // Terminate the list. }; diff --git a/generator/well_known_types_embed.h b/generator/well_known_types_embed.h index 08e494f3..f9e23557 100644 --- a/generator/well_known_types_embed.h +++ b/generator/well_known_types_embed.h @@ -36,6 +36,7 @@ struct FileToc { const char* name; const char* data; + const char* es6_data; const char* dts_data; }; From e347898f2a0ad55db10db73e2932723fbd785444 Mon Sep 17 00:00:00 2001 From: Jacob Fugal Date: Wed, 15 Jan 2025 14:11:47 -0700 Subject: [PATCH 06/12] add regression testing of closure output to example --- example/README.md | 10 + example/test.closure-new.js | 9724 +++++++++++++++++++++++++++++++++++ example/test.closure-old.js | 9724 +++++++++++++++++++++++++++++++++++ example/test.closure.diff | 0 4 files changed, 19458 insertions(+) create mode 100644 example/test.closure-new.js create mode 100644 example/test.closure-old.js create mode 100644 example/test.closure.diff diff --git a/example/README.md b/example/README.md index dcd9d5fd..78fa76ac 100644 --- a/example/README.md +++ b/example/README.md @@ -9,3 +9,13 @@ then: `protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=protos --js_out=library=example/test,import_style=es6,generate_dts,binary:. protos/test.proto` Generated both `example/test.js` with ES6-style imports/exports and `example/test.d.ts` with TypeScript definitions. + +To regression test Closure output: + +``` +git checkout origin/main +protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=protos --js_out=library=example/test,import_style=closure,binary:. protos/test.proto && mv example/test.js example/test.closure-old.js +git checkout lukfugl/es6 +protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=protos --js_out=library=example/test,import_style=closure,binary:. protos/test.proto && mv example/test.js example/test.closure-new.js +diff example/test.closure-* > example/test.closure.diff # empty +``` \ No newline at end of file diff --git a/example/test.closure-new.js b/example/test.closure-new.js new file mode 100644 index 00000000..d1f8d940 --- /dev/null +++ b/example/test.closure-new.js @@ -0,0 +1,9724 @@ +// source: test.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + + +goog.provide('proto.jspb.test.BooleanFields'); +goog.provide('proto.jspb.test.CloneExtension'); +goog.provide('proto.jspb.test.Complex'); +goog.provide('proto.jspb.test.Complex.Nested'); +goog.provide('proto.jspb.test.Deeply'); +goog.provide('proto.jspb.test.Deeply.Nested'); +goog.provide('proto.jspb.test.Deeply.Nested.Message'); +goog.provide('proto.jspb.test.DefaultValues'); +goog.provide('proto.jspb.test.DefaultValues.Enum'); +goog.provide('proto.jspb.test.Empty'); +goog.provide('proto.jspb.test.EnumContainer'); +goog.provide('proto.jspb.test.FloatingPointFields'); +goog.provide('proto.jspb.test.HasExtensions'); +goog.provide('proto.jspb.test.IndirectExtension'); +goog.provide('proto.jspb.test.Int64Types'); +goog.provide('proto.jspb.test.IsExtension'); +goog.provide('proto.jspb.test.MapValueEnumNoBinary'); +goog.provide('proto.jspb.test.MapValueMessageNoBinary'); +goog.provide('proto.jspb.test.MineField'); +goog.provide('proto.jspb.test.OptionalFields'); +goog.provide('proto.jspb.test.OptionalFields.Nested'); +goog.provide('proto.jspb.test.OuterEnum'); +goog.provide('proto.jspb.test.OuterMessage'); +goog.provide('proto.jspb.test.OuterMessage.Complex'); +goog.provide('proto.jspb.test.Simple1'); +goog.provide('proto.jspb.test.Simple2'); +goog.provide('proto.jspb.test.SpecialCases'); +goog.provide('proto.jspb.test.TestAllowAliasEnum'); +goog.provide('proto.jspb.test.TestClone'); +goog.provide('proto.jspb.test.TestCloneExtension'); +goog.provide('proto.jspb.test.TestEndsWithBytes'); +goog.provide('proto.jspb.test.TestGroup'); +goog.provide('proto.jspb.test.TestGroup.OptionalGroup'); +goog.provide('proto.jspb.test.TestGroup.RepeatedGroup'); +goog.provide('proto.jspb.test.TestGroup.RequiredGroup'); +goog.provide('proto.jspb.test.TestGroup1'); +goog.provide('proto.jspb.test.TestLastFieldBeforePivot'); +goog.provide('proto.jspb.test.TestMapFieldsNoBinary'); +goog.provide('proto.jspb.test.TestMessageWithOneof'); +goog.provide('proto.jspb.test.TestMessageWithOneof.DefaultOneofACase'); +goog.provide('proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase'); +goog.provide('proto.jspb.test.TestMessageWithOneof.PartialOneofCase'); +goog.provide('proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase'); +goog.provide('proto.jspb.test.TestReservedNames'); +goog.provide('proto.jspb.test.TestReservedNamesExtension'); +goog.provide('proto.jspb.test.extendTestLastFieldBeforePivotField'); +goog.provide('proto.jspb.test.simple1'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.ExtensionFieldBinaryInfo'); +goog.require('jspb.ExtensionFieldInfo'); +goog.require('jspb.Map'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Empty = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Empty, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Empty.displayName = 'proto.jspb.test.Empty'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.EnumContainer = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.EnumContainer, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.EnumContainer.displayName = 'proto.jspb.test.EnumContainer'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Simple1 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.Simple1.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.Simple1, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Simple1.displayName = 'proto.jspb.test.Simple1'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Simple2 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.Simple2.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.Simple2, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Simple2.displayName = 'proto.jspb.test.Simple2'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.SpecialCases = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.SpecialCases, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.SpecialCases.displayName = 'proto.jspb.test.SpecialCases'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.OptionalFields = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.OptionalFields.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.OptionalFields, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.OptionalFields.displayName = 'proto.jspb.test.OptionalFields'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.OptionalFields.Nested = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.OptionalFields.Nested, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.OptionalFields.Nested.displayName = 'proto.jspb.test.OptionalFields.Nested'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.HasExtensions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 4, null, null); +}; +goog.inherits(proto.jspb.test.HasExtensions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.HasExtensions.displayName = 'proto.jspb.test.HasExtensions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.HasExtensions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.HasExtensions.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Complex = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.Complex.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.Complex, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Complex.displayName = 'proto.jspb.test.Complex'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Complex.Nested = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Complex.Nested, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Complex.Nested.displayName = 'proto.jspb.test.Complex.Nested'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.OuterMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.OuterMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.OuterMessage.displayName = 'proto.jspb.test.OuterMessage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.OuterMessage.Complex = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.OuterMessage.Complex, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.OuterMessage.Complex.displayName = 'proto.jspb.test.OuterMessage.Complex'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.MineField = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.MineField, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.MineField.displayName = 'proto.jspb.test.MineField'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.IsExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.IsExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.IsExtension.displayName = 'proto.jspb.test.IsExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.IndirectExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.IndirectExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.IndirectExtension.displayName = 'proto.jspb.test.IndirectExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.DefaultValues = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.DefaultValues, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.DefaultValues.displayName = 'proto.jspb.test.DefaultValues'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.FloatingPointFields = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.FloatingPointFields.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.FloatingPointFields, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.FloatingPointFields.displayName = 'proto.jspb.test.FloatingPointFields'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.BooleanFields = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.BooleanFields.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.BooleanFields, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.BooleanFields.displayName = 'proto.jspb.test.BooleanFields'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestClone = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 8, proto.jspb.test.TestClone.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.TestClone, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestClone.displayName = 'proto.jspb.test.TestClone'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestClone.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestClone.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestCloneExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestCloneExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestCloneExtension.displayName = 'proto.jspb.test.TestCloneExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.CloneExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.CloneExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.CloneExtension.displayName = 'proto.jspb.test.CloneExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.TestGroup.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.TestGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup.displayName = 'proto.jspb.test.TestGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup.RepeatedGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.TestGroup.RepeatedGroup.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.TestGroup.RepeatedGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup.RepeatedGroup.displayName = 'proto.jspb.test.TestGroup.RepeatedGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup.RequiredGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestGroup.RequiredGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup.RequiredGroup.displayName = 'proto.jspb.test.TestGroup.RequiredGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup.OptionalGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestGroup.OptionalGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup.OptionalGroup.displayName = 'proto.jspb.test.TestGroup.OptionalGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup1 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestGroup1, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup1.displayName = 'proto.jspb.test.TestGroup1'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestReservedNames = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); +}; +goog.inherits(proto.jspb.test.TestReservedNames, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestReservedNames.displayName = 'proto.jspb.test.TestReservedNames'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestReservedNames.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestReservedNames.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestReservedNamesExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestReservedNamesExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestReservedNamesExtension.displayName = 'proto.jspb.test.TestReservedNamesExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestMessageWithOneof = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.TestMessageWithOneof.repeatedFields_, proto.jspb.test.TestMessageWithOneof.oneofGroups_); +}; +goog.inherits(proto.jspb.test.TestMessageWithOneof, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestMessageWithOneof.displayName = 'proto.jspb.test.TestMessageWithOneof'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestEndsWithBytes = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestEndsWithBytes, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestEndsWithBytes.displayName = 'proto.jspb.test.TestEndsWithBytes'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestLastFieldBeforePivot = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); +}; +goog.inherits(proto.jspb.test.TestLastFieldBeforePivot, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestLastFieldBeforePivot.displayName = 'proto.jspb.test.TestLastFieldBeforePivot'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestLastFieldBeforePivot.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Int64Types = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Int64Types, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Int64Types.displayName = 'proto.jspb.test.Int64Types'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestMapFieldsNoBinary = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestMapFieldsNoBinary, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestMapFieldsNoBinary.displayName = 'proto.jspb.test.TestMapFieldsNoBinary'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.MapValueMessageNoBinary = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.MapValueMessageNoBinary, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.MapValueMessageNoBinary.displayName = 'proto.jspb.test.MapValueMessageNoBinary'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Deeply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Deeply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Deeply.displayName = 'proto.jspb.test.Deeply'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Deeply.Nested = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Deeply.Nested, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Deeply.Nested.displayName = 'proto.jspb.test.Deeply.Nested'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Deeply.Nested.Message = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Deeply.Nested.Message, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Deeply.Nested.Message.displayName = 'proto.jspb.test.Deeply.Nested.Message'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Empty.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Empty.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Empty} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Empty.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Empty} + */ +proto.jspb.test.Empty.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Empty; + return proto.jspb.test.Empty.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Empty} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Empty} + */ +proto.jspb.test.Empty.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Empty.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Empty.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Empty} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Empty.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.EnumContainer.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.EnumContainer.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.EnumContainer} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.EnumContainer.toObject = function(includeInstance, msg) { + var f, obj = { +outerEnum: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.EnumContainer} + */ +proto.jspb.test.EnumContainer.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.EnumContainer; + return proto.jspb.test.EnumContainer.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.EnumContainer} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.EnumContainer} + */ +proto.jspb.test.EnumContainer.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.jspb.test.OuterEnum} */ (reader.readEnum()); + msg.setOuterEnum(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.EnumContainer.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.EnumContainer.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.EnumContainer} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.EnumContainer.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeEnum( + 1, + f + ); + } +}; + + +/** + * optional OuterEnum outer_enum = 1; + * @return {!proto.jspb.test.OuterEnum} + */ +proto.jspb.test.EnumContainer.prototype.getOuterEnum = function() { + return /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getFieldWithDefault(this, 1, 1)); +}; + + +/** + * @param {!proto.jspb.test.OuterEnum} value + * @return {!proto.jspb.test.EnumContainer} returns this + */ +proto.jspb.test.EnumContainer.prototype.setOuterEnum = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.EnumContainer} returns this + */ +proto.jspb.test.EnumContainer.prototype.clearOuterEnum = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.EnumContainer.prototype.hasOuterEnum = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.Simple1.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Simple1.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Simple1.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Simple1} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Simple1.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f, +aBoolean: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Simple1} + */ +proto.jspb.test.Simple1.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Simple1; + return proto.jspb.test.Simple1.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Simple1} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Simple1} + */ +proto.jspb.test.Simple1.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setABoolean(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Simple1.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Simple1.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Simple1} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Simple1.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeBool( + 3, + f + ); + } +}; + + +/** + * required string a_string = 1; + * @return {string} + */ +proto.jspb.test.Simple1.prototype.getAString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.setAString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.clearAString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Simple1.prototype.hasAString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated string a_repeated_string = 2; + * @return {!Array} + */ +proto.jspb.test.Simple1.prototype.getARepeatedStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.setARepeatedStringList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.addARepeatedString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.clearARepeatedStringList = function() { + return this.setARepeatedStringList([]); +}; + + +/** + * optional bool a_boolean = 3; + * @return {boolean} + */ +proto.jspb.test.Simple1.prototype.getABoolean = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.setABoolean = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.clearABoolean = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Simple1.prototype.hasABoolean = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.Simple2.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Simple2.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Simple2.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Simple2} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Simple2.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Simple2} + */ +proto.jspb.test.Simple2.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Simple2; + return proto.jspb.test.Simple2.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Simple2} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Simple2} + */ +proto.jspb.test.Simple2.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Simple2.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Simple2.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Simple2} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Simple2.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } +}; + + +/** + * required string a_string = 1; + * @return {string} + */ +proto.jspb.test.Simple2.prototype.getAString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.setAString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.clearAString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Simple2.prototype.hasAString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated string a_repeated_string = 2; + * @return {!Array} + */ +proto.jspb.test.Simple2.prototype.getARepeatedStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.setARepeatedStringList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.addARepeatedString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.clearARepeatedStringList = function() { + return this.setARepeatedStringList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.SpecialCases.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.SpecialCases.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.SpecialCases} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.SpecialCases.toObject = function(includeInstance, msg) { + var f, obj = { +normal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +pb_default: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, +pb_function: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, +pb_var: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.SpecialCases} + */ +proto.jspb.test.SpecialCases.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.SpecialCases; + return proto.jspb.test.SpecialCases.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.SpecialCases} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.SpecialCases} + */ +proto.jspb.test.SpecialCases.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setNormal(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDefault(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setFunction(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setVar(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.SpecialCases.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.SpecialCases.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.SpecialCases} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.SpecialCases.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeString( + 4, + f + ); + } +}; + + +/** + * required string normal = 1; + * @return {string} + */ +proto.jspb.test.SpecialCases.prototype.getNormal = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.setNormal = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.clearNormal = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.SpecialCases.prototype.hasNormal = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required string default = 2; + * @return {string} + */ +proto.jspb.test.SpecialCases.prototype.getDefault = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.setDefault = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.clearDefault = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.SpecialCases.prototype.hasDefault = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * required string function = 3; + * @return {string} + */ +proto.jspb.test.SpecialCases.prototype.getFunction = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.setFunction = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.clearFunction = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.SpecialCases.prototype.hasFunction = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * required string var = 4; + * @return {string} + */ +proto.jspb.test.SpecialCases.prototype.getVar = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.setVar = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.clearVar = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.SpecialCases.prototype.hasVar = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.OptionalFields.repeatedFields_ = [4,5]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.OptionalFields.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.OptionalFields.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OptionalFields} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OptionalFields.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +aBool: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, +aNestedMessage: (f = msg.getANestedMessage()) && proto.jspb.test.OptionalFields.Nested.toObject(includeInstance, f), +aRepeatedMessageList: jspb.Message.toObjectList(msg.getARepeatedMessageList(), + proto.jspb.test.OptionalFields.Nested.toObject, includeInstance), +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OptionalFields} + */ +proto.jspb.test.OptionalFields.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.OptionalFields; + return proto.jspb.test.OptionalFields.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OptionalFields} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OptionalFields} + */ +proto.jspb.test.OptionalFields.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setABool(value); + break; + case 3: + var value = new proto.jspb.test.OptionalFields.Nested; + reader.readMessage(value,proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader); + msg.setANestedMessage(value); + break; + case 4: + var value = new proto.jspb.test.OptionalFields.Nested; + reader.readMessage(value,proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader); + msg.addARepeatedMessage(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.OptionalFields.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.OptionalFields.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OptionalFields} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OptionalFields.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = message.getANestedMessage(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedMessageList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 5, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.OptionalFields.Nested.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.OptionalFields.Nested.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OptionalFields.Nested} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OptionalFields.Nested.toObject = function(includeInstance, msg) { + var f, obj = { +anInt: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OptionalFields.Nested} + */ +proto.jspb.test.OptionalFields.Nested.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.OptionalFields.Nested; + return proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OptionalFields.Nested} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OptionalFields.Nested} + */ +proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAnInt(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.OptionalFields.Nested.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OptionalFields.Nested} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 an_int = 1; + * @return {number} + */ +proto.jspb.test.OptionalFields.Nested.prototype.getAnInt = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.OptionalFields.Nested} returns this + */ +proto.jspb.test.OptionalFields.Nested.prototype.setAnInt = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OptionalFields.Nested} returns this + */ +proto.jspb.test.OptionalFields.Nested.prototype.clearAnInt = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OptionalFields.Nested.prototype.hasAnInt = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string a_string = 1; + * @return {string} + */ +proto.jspb.test.OptionalFields.prototype.getAString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.setAString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearAString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OptionalFields.prototype.hasAString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required bool a_bool = 2; + * @return {boolean} + */ +proto.jspb.test.OptionalFields.prototype.getABool = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.setABool = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearABool = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OptionalFields.prototype.hasABool = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional Nested a_nested_message = 3; + * @return {?proto.jspb.test.OptionalFields.Nested} + */ +proto.jspb.test.OptionalFields.prototype.getANestedMessage = function() { + return /** @type{?proto.jspb.test.OptionalFields.Nested} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.OptionalFields.Nested, 3)); +}; + + +/** + * @param {?proto.jspb.test.OptionalFields.Nested|undefined} value + * @return {!proto.jspb.test.OptionalFields} returns this +*/ +proto.jspb.test.OptionalFields.prototype.setANestedMessage = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearANestedMessage = function() { + return this.setANestedMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OptionalFields.prototype.hasANestedMessage = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated Nested a_repeated_message = 4; + * @return {!Array} + */ +proto.jspb.test.OptionalFields.prototype.getARepeatedMessageList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.OptionalFields.Nested, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.OptionalFields} returns this +*/ +proto.jspb.test.OptionalFields.prototype.setARepeatedMessageList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.jspb.test.OptionalFields.Nested=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.OptionalFields.Nested} + */ +proto.jspb.test.OptionalFields.prototype.addARepeatedMessage = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.jspb.test.OptionalFields.Nested, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearARepeatedMessageList = function() { + return this.setARepeatedMessageList([]); +}; + + +/** + * repeated string a_repeated_string = 5; + * @return {!Array} + */ +proto.jspb.test.OptionalFields.prototype.getARepeatedStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.setARepeatedStringList = function(value) { + return jspb.Message.setField(this, 5, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.addARepeatedString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 5, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearARepeatedStringList = function() { + return this.setARepeatedStringList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.HasExtensions.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.HasExtensions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.HasExtensions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.HasExtensions.toObject = function(includeInstance, msg) { + var f, obj = { +str1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +str2: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, +str3: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.HasExtensions.extensions, proto.jspb.test.HasExtensions.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.HasExtensions} + */ +proto.jspb.test.HasExtensions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.HasExtensions; + return proto.jspb.test.HasExtensions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.HasExtensions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.HasExtensions} + */ +proto.jspb.test.HasExtensions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStr1(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setStr2(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setStr3(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.HasExtensions.extensionsBinary, + proto.jspb.test.HasExtensions.prototype.getExtension, + proto.jspb.test.HasExtensions.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.HasExtensions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.HasExtensions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.HasExtensions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.HasExtensions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.HasExtensions.extensionsBinary, proto.jspb.test.HasExtensions.prototype.getExtension); +}; + + +/** + * optional string str1 = 1; + * @return {string} + */ +proto.jspb.test.HasExtensions.prototype.getStr1 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.setStr1 = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.clearStr1 = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.HasExtensions.prototype.hasStr1 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string str2 = 2; + * @return {string} + */ +proto.jspb.test.HasExtensions.prototype.getStr2 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.setStr2 = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.clearStr2 = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.HasExtensions.prototype.hasStr2 = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional string str3 = 3; + * @return {string} + */ +proto.jspb.test.HasExtensions.prototype.getStr3 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.setStr3 = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.clearStr3 = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.HasExtensions.prototype.hasStr3 = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.Complex.repeatedFields_ = [5,7]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Complex.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Complex.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Complex} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Complex.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +anOutOfOrderBool: (f = jspb.Message.getBooleanField(msg, 9)) == null ? undefined : f, +aNestedMessage: (f = msg.getANestedMessage()) && proto.jspb.test.Complex.Nested.toObject(includeInstance, f), +aRepeatedMessageList: jspb.Message.toObjectList(msg.getARepeatedMessageList(), + proto.jspb.test.Complex.Nested.toObject, includeInstance), +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 7)) == null ? undefined : f, +aFloatingPointField: (f = jspb.Message.getOptionalFloatingPointField(msg, 10)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Complex} + */ +proto.jspb.test.Complex.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Complex; + return proto.jspb.test.Complex.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Complex} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Complex} + */ +proto.jspb.test.Complex.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 9: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAnOutOfOrderBool(value); + break; + case 4: + var value = new proto.jspb.test.Complex.Nested; + reader.readMessage(value,proto.jspb.test.Complex.Nested.deserializeBinaryFromReader); + msg.setANestedMessage(value); + break; + case 5: + var value = new proto.jspb.test.Complex.Nested; + reader.readMessage(value,proto.jspb.test.Complex.Nested.deserializeBinaryFromReader); + msg.addARepeatedMessage(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + case 10: + var value = /** @type {number} */ (reader.readDouble()); + msg.setAFloatingPointField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Complex.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Complex.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Complex} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Complex.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 9)); + if (f != null) { + writer.writeBool( + 9, + f + ); + } + f = message.getANestedMessage(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.jspb.test.Complex.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedMessageList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + proto.jspb.test.Complex.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 7, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeDouble( + 10, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Complex.Nested.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Complex.Nested.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Complex.Nested} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Complex.Nested.toObject = function(includeInstance, msg) { + var f, obj = { +anInt: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Complex.Nested} + */ +proto.jspb.test.Complex.Nested.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Complex.Nested; + return proto.jspb.test.Complex.Nested.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Complex.Nested} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Complex.Nested} + */ +proto.jspb.test.Complex.Nested.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAnInt(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Complex.Nested.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Complex.Nested.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Complex.Nested} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Complex.Nested.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeInt32( + 2, + f + ); + } +}; + + +/** + * required int32 an_int = 2; + * @return {number} + */ +proto.jspb.test.Complex.Nested.prototype.getAnInt = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Complex.Nested} returns this + */ +proto.jspb.test.Complex.Nested.prototype.setAnInt = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex.Nested} returns this + */ +proto.jspb.test.Complex.Nested.prototype.clearAnInt = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.Nested.prototype.hasAnInt = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * required string a_string = 1; + * @return {string} + */ +proto.jspb.test.Complex.prototype.getAString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.setAString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearAString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.hasAString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bool an_out_of_order_bool = 9; + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.getAnOutOfOrderBool = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.setAnOutOfOrderBool = function(value) { + return jspb.Message.setField(this, 9, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearAnOutOfOrderBool = function() { + return jspb.Message.setField(this, 9, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.hasAnOutOfOrderBool = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional Nested a_nested_message = 4; + * @return {?proto.jspb.test.Complex.Nested} + */ +proto.jspb.test.Complex.prototype.getANestedMessage = function() { + return /** @type{?proto.jspb.test.Complex.Nested} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Complex.Nested, 4)); +}; + + +/** + * @param {?proto.jspb.test.Complex.Nested|undefined} value + * @return {!proto.jspb.test.Complex} returns this +*/ +proto.jspb.test.Complex.prototype.setANestedMessage = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearANestedMessage = function() { + return this.setANestedMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.hasANestedMessage = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * repeated Nested a_repeated_message = 5; + * @return {!Array} + */ +proto.jspb.test.Complex.prototype.getARepeatedMessageList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.Complex.Nested, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.Complex} returns this +*/ +proto.jspb.test.Complex.prototype.setARepeatedMessageList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 5, value); +}; + + +/** + * @param {!proto.jspb.test.Complex.Nested=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.Complex.Nested} + */ +proto.jspb.test.Complex.prototype.addARepeatedMessage = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.jspb.test.Complex.Nested, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearARepeatedMessageList = function() { + return this.setARepeatedMessageList([]); +}; + + +/** + * repeated string a_repeated_string = 7; + * @return {!Array} + */ +proto.jspb.test.Complex.prototype.getARepeatedStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 7)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.setARepeatedStringList = function(value) { + return jspb.Message.setField(this, 7, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.addARepeatedString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 7, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearARepeatedStringList = function() { + return this.setARepeatedStringList([]); +}; + + +/** + * optional double a_floating_point_field = 10; + * @return {number} + */ +proto.jspb.test.Complex.prototype.getAFloatingPointField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 10, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.setAFloatingPointField = function(value) { + return jspb.Message.setField(this, 10, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearAFloatingPointField = function() { + return jspb.Message.setField(this, 10, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.hasAFloatingPointField = function() { + return jspb.Message.getField(this, 10) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.OuterMessage.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.OuterMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OuterMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OuterMessage.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OuterMessage} + */ +proto.jspb.test.OuterMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.OuterMessage; + return proto.jspb.test.OuterMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OuterMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OuterMessage} + */ +proto.jspb.test.OuterMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.OuterMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.OuterMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OuterMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OuterMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.OuterMessage.Complex.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.OuterMessage.Complex.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OuterMessage.Complex} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OuterMessage.Complex.toObject = function(includeInstance, msg) { + var f, obj = { +innerComplexField: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OuterMessage.Complex} + */ +proto.jspb.test.OuterMessage.Complex.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.OuterMessage.Complex; + return proto.jspb.test.OuterMessage.Complex.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OuterMessage.Complex} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OuterMessage.Complex} + */ +proto.jspb.test.OuterMessage.Complex.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setInnerComplexField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.OuterMessage.Complex.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.OuterMessage.Complex.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OuterMessage.Complex} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OuterMessage.Complex.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 inner_complex_field = 1; + * @return {number} + */ +proto.jspb.test.OuterMessage.Complex.prototype.getInnerComplexField = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.OuterMessage.Complex} returns this + */ +proto.jspb.test.OuterMessage.Complex.prototype.setInnerComplexField = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OuterMessage.Complex} returns this + */ +proto.jspb.test.OuterMessage.Complex.prototype.clearInnerComplexField = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OuterMessage.Complex.prototype.hasInnerComplexField = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.MineField.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.MineField.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.MineField} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.MineField.toObject = function(includeInstance, msg) { + var f, obj = { +cookie: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.MineField} + */ +proto.jspb.test.MineField.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.MineField; + return proto.jspb.test.MineField.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.MineField} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.MineField} + */ +proto.jspb.test.MineField.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setCookie(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.MineField.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.MineField.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.MineField} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.MineField.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string cookie = 1; + * @return {string} + */ +proto.jspb.test.MineField.prototype.getCookie = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.MineField} returns this + */ +proto.jspb.test.MineField.prototype.setCookie = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.MineField} returns this + */ +proto.jspb.test.MineField.prototype.clearCookie = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.MineField.prototype.hasCookie = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.IsExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.IsExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.IsExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.IsExtension.toObject = function(includeInstance, msg) { + var f, obj = { +ext1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.IsExtension} + */ +proto.jspb.test.IsExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.IsExtension; + return proto.jspb.test.IsExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.IsExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.IsExtension} + */ +proto.jspb.test.IsExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setExt1(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.IsExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.IsExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.IsExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.IsExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IsExtension.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + proto.jspb.test.IsExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.IsExtension.toObject), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IsExtension.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.IsExtension.serializeBinaryToWriter, + proto.jspb.test.IsExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[100] = proto.jspb.test.IsExtension.extField; + +/** + * optional string ext1 = 1; + * @return {string} + */ +proto.jspb.test.IsExtension.prototype.getExt1 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.IsExtension} returns this + */ +proto.jspb.test.IsExtension.prototype.setExt1 = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.IsExtension} returns this + */ +proto.jspb.test.IsExtension.prototype.clearExt1 = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.IsExtension.prototype.hasExt1 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.IndirectExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.IndirectExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.IndirectExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.IndirectExtension.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.IndirectExtension} + */ +proto.jspb.test.IndirectExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.IndirectExtension; + return proto.jspb.test.IndirectExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.IndirectExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.IndirectExtension} + */ +proto.jspb.test.IndirectExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.IndirectExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.IndirectExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.IndirectExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.IndirectExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `simple`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IndirectExtension.simple = new jspb.ExtensionFieldInfo( + 101, + {simple: 0}, + proto.jspb.test.Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.Simple1.toObject), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.simple, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.Simple1.serializeBinaryToWriter, + proto.jspb.test.Simple1.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[101] = proto.jspb.test.IndirectExtension.simple; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `str`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IndirectExtension.str = new jspb.ExtensionFieldInfo( + 102, + {str: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.str, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[102] = proto.jspb.test.IndirectExtension.str; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `repeatedStrList`. + * @type {!jspb.ExtensionFieldInfo>} + */ +proto.jspb.test.IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( + 103, + {repeatedStrList: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 1); + +proto.jspb.test.HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.repeatedStrList, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeRepeatedString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[103] = proto.jspb.test.IndirectExtension.repeatedStrList; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `repeatedSimpleList`. + * @type {!jspb.ExtensionFieldInfo>} + */ +proto.jspb.test.IndirectExtension.repeatedSimpleList = new jspb.ExtensionFieldInfo( + 104, + {repeatedSimpleList: 0}, + proto.jspb.test.Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.Simple1.toObject), + 1); + +proto.jspb.test.HasExtensions.extensionsBinary[104] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.repeatedSimpleList, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeRepeatedMessage, + proto.jspb.test.Simple1.serializeBinaryToWriter, + proto.jspb.test.Simple1.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[104] = proto.jspb.test.IndirectExtension.repeatedSimpleList; + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.DefaultValues.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.DefaultValues.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.DefaultValues} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.DefaultValues.toObject = function(includeInstance, msg) { + var f, obj = { +stringField: jspb.Message.getFieldWithDefault(msg, 1, "default\x3c\x3e\x27\x22abc"), +boolField: jspb.Message.getBooleanFieldWithDefault(msg, 2, true), +intField: jspb.Message.getFieldWithDefault(msg, 3, 11), +enumField: jspb.Message.getFieldWithDefault(msg, 4, 13), +emptyField: jspb.Message.getFieldWithDefault(msg, 6, ""), +bytesField: msg.getBytesField_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.DefaultValues} + */ +proto.jspb.test.DefaultValues.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.DefaultValues; + return proto.jspb.test.DefaultValues.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.DefaultValues} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.DefaultValues} + */ +proto.jspb.test.DefaultValues.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStringField(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setBoolField(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setIntField(value); + break; + case 4: + var value = /** @type {!proto.jspb.test.DefaultValues.Enum} */ (reader.readEnum()); + msg.setEnumField(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setEmptyField(value); + break; + case 8: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBytesField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.DefaultValues.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.DefaultValues.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.DefaultValues} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.DefaultValues.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeInt64( + 3, + f + ); + } + f = /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeEnum( + 4, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeString( + 6, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeBytes( + 8, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.jspb.test.DefaultValues.Enum = { + E1: 13, + E2: 77 +}; + +/** + * optional string string_field = 1; + * @return {string} + */ +proto.jspb.test.DefaultValues.prototype.getStringField = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "default\x3c\x3e\x27\x22abc")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setStringField = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearStringField = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasStringField = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bool bool_field = 2; + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.getBoolField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, true)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setBoolField = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearBoolField = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasBoolField = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional int64 int_field = 3; + * @return {number} + */ +proto.jspb.test.DefaultValues.prototype.getIntField = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 11)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setIntField = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearIntField = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasIntField = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional Enum enum_field = 4; + * @return {!proto.jspb.test.DefaultValues.Enum} + */ +proto.jspb.test.DefaultValues.prototype.getEnumField = function() { + return /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getFieldWithDefault(this, 4, 13)); +}; + + +/** + * @param {!proto.jspb.test.DefaultValues.Enum} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setEnumField = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearEnumField = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasEnumField = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional string empty_field = 6; + * @return {string} + */ +proto.jspb.test.DefaultValues.prototype.getEmptyField = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setEmptyField = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearEmptyField = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasEmptyField = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional bytes bytes_field = 8; + * @return {!(string|Uint8Array)} + */ +proto.jspb.test.DefaultValues.prototype.getBytesField = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 8, "bW9v")); +}; + + +/** + * optional bytes bytes_field = 8; + * This is a type-conversion wrapper around `getBytesField()` + * @return {string} + */ +proto.jspb.test.DefaultValues.prototype.getBytesField_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBytesField())); +}; + + +/** + * optional bytes bytes_field = 8; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBytesField()` + * @return {!Uint8Array} + */ +proto.jspb.test.DefaultValues.prototype.getBytesField_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBytesField())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setBytesField = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearBytesField = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasBytesField = function() { + return jspb.Message.getField(this, 8) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.FloatingPointFields.repeatedFields_ = [3,7]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.FloatingPointFields.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.FloatingPointFields.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.FloatingPointFields} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.FloatingPointFields.toObject = function(includeInstance, msg) { + var f, obj = { +optionalFloatField: (f = jspb.Message.getOptionalFloatingPointField(msg, 1)) == null ? undefined : f, +requiredFloatField: (f = jspb.Message.getOptionalFloatingPointField(msg, 2)) == null ? undefined : f, +repeatedFloatFieldList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 3)) == null ? undefined : f, +defaultFloatField: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 2.0), +optionalDoubleField: (f = jspb.Message.getOptionalFloatingPointField(msg, 5)) == null ? undefined : f, +requiredDoubleField: (f = jspb.Message.getOptionalFloatingPointField(msg, 6)) == null ? undefined : f, +repeatedDoubleFieldList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 7)) == null ? undefined : f, +defaultDoubleField: jspb.Message.getFloatingPointFieldWithDefault(msg, 8, 2.0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.FloatingPointFields} + */ +proto.jspb.test.FloatingPointFields.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.FloatingPointFields; + return proto.jspb.test.FloatingPointFields.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.FloatingPointFields} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.FloatingPointFields} + */ +proto.jspb.test.FloatingPointFields.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readFloat()); + msg.setOptionalFloatField(value); + break; + case 2: + var value = /** @type {number} */ (reader.readFloat()); + msg.setRequiredFloatField(value); + break; + case 3: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readFloat() : [reader.readFloat()]); + for (var i = 0; i < values.length; i++) { + msg.addRepeatedFloatField(values[i]); + } + break; + case 4: + var value = /** @type {number} */ (reader.readFloat()); + msg.setDefaultFloatField(value); + break; + case 5: + var value = /** @type {number} */ (reader.readDouble()); + msg.setOptionalDoubleField(value); + break; + case 6: + var value = /** @type {number} */ (reader.readDouble()); + msg.setRequiredDoubleField(value); + break; + case 7: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readDouble() : [reader.readDouble()]); + for (var i = 0; i < values.length; i++) { + msg.addRepeatedDoubleField(values[i]); + } + break; + case 8: + var value = /** @type {number} */ (reader.readDouble()); + msg.setDefaultDoubleField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.FloatingPointFields.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.FloatingPointFields.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.FloatingPointFields} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.FloatingPointFields.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeFloat( + 1, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeFloat( + 2, + f + ); + } + f = message.getRepeatedFloatFieldList(); + if (f.length > 0) { + writer.writeRepeatedFloat( + 3, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeFloat( + 4, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeDouble( + 5, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeDouble( + 6, + f + ); + } + f = message.getRepeatedDoubleFieldList(); + if (f.length > 0) { + writer.writeRepeatedDouble( + 7, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeDouble( + 8, + f + ); + } +}; + + +/** + * optional float optional_float_field = 1; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getOptionalFloatField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setOptionalFloatField = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearOptionalFloatField = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasOptionalFloatField = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required float required_float_field = 2; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getRequiredFloatField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setRequiredFloatField = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearRequiredFloatField = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasRequiredFloatField = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * repeated float repeated_float_field = 3; + * @return {!Array} + */ +proto.jspb.test.FloatingPointFields.prototype.getRepeatedFloatFieldList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setRepeatedFloatFieldList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.addRepeatedFloatField = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearRepeatedFloatFieldList = function() { + return this.setRepeatedFloatFieldList([]); +}; + + +/** + * optional float default_float_field = 4; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getDefaultFloatField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 2.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setDefaultFloatField = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearDefaultFloatField = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasDefaultFloatField = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional double optional_double_field = 5; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getOptionalDoubleField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setOptionalDoubleField = function(value) { + return jspb.Message.setField(this, 5, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearOptionalDoubleField = function() { + return jspb.Message.setField(this, 5, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasOptionalDoubleField = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * required double required_double_field = 6; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getRequiredDoubleField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 6, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setRequiredDoubleField = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearRequiredDoubleField = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasRequiredDoubleField = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * repeated double repeated_double_field = 7; + * @return {!Array} + */ +proto.jspb.test.FloatingPointFields.prototype.getRepeatedDoubleFieldList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 7)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setRepeatedDoubleFieldList = function(value) { + return jspb.Message.setField(this, 7, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.addRepeatedDoubleField = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 7, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearRepeatedDoubleFieldList = function() { + return this.setRepeatedDoubleFieldList([]); +}; + + +/** + * optional double default_double_field = 8; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getDefaultDoubleField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 8, 2.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setDefaultDoubleField = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearDefaultDoubleField = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasDefaultDoubleField = function() { + return jspb.Message.getField(this, 8) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.BooleanFields.repeatedFields_ = [3]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.BooleanFields.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.BooleanFields.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.BooleanFields} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.BooleanFields.toObject = function(includeInstance, msg) { + var f, obj = { +optionalBooleanField: (f = jspb.Message.getBooleanField(msg, 1)) == null ? undefined : f, +requiredBooleanField: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, +repeatedBooleanFieldList: (f = jspb.Message.getRepeatedBooleanField(msg, 3)) == null ? undefined : f, +defaultBooleanField: jspb.Message.getBooleanFieldWithDefault(msg, 4, true) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.BooleanFields} + */ +proto.jspb.test.BooleanFields.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.BooleanFields; + return proto.jspb.test.BooleanFields.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.BooleanFields} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.BooleanFields} + */ +proto.jspb.test.BooleanFields.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOptionalBooleanField(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setRequiredBooleanField(value); + break; + case 3: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readBool() : [reader.readBool()]); + for (var i = 0; i < values.length; i++) { + msg.addRepeatedBooleanField(values[i]); + } + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDefaultBooleanField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.BooleanFields.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.BooleanFields.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.BooleanFields} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.BooleanFields.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {boolean} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeBool( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = message.getRepeatedBooleanFieldList(); + if (f.length > 0) { + writer.writeRepeatedBool( + 3, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeBool( + 4, + f + ); + } +}; + + +/** + * optional bool optional_boolean_field = 1; + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.getOptionalBooleanField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.setOptionalBooleanField = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.clearOptionalBooleanField = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.hasOptionalBooleanField = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required bool required_boolean_field = 2; + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.getRequiredBooleanField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.setRequiredBooleanField = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.clearRequiredBooleanField = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.hasRequiredBooleanField = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * repeated bool repeated_boolean_field = 3; + * @return {!Array} + */ +proto.jspb.test.BooleanFields.prototype.getRepeatedBooleanFieldList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.setRepeatedBooleanFieldList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {boolean} value + * @param {number=} opt_index + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.addRepeatedBooleanField = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.clearRepeatedBooleanFieldList = function() { + return this.setRepeatedBooleanFieldList([]); +}; + + +/** + * optional bool default_boolean_field = 4; + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.getDefaultBooleanField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, true)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.setDefaultBooleanField = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.clearDefaultBooleanField = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.hasDefaultBooleanField = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.TestClone.repeatedFields_ = [5]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestClone.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestClone.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestClone} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestClone.toObject = function(includeInstance, msg) { + var f, obj = { +str: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +simple1: (f = msg.getSimple1()) && proto.jspb.test.Simple1.toObject(includeInstance, f), +simple2List: jspb.Message.toObjectList(msg.getSimple2List(), + proto.jspb.test.Simple1.toObject, includeInstance), +bytesField: msg.getBytesField_asB64(), +unused: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.TestClone.extensions, proto.jspb.test.TestClone.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestClone} + */ +proto.jspb.test.TestClone.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestClone; + return proto.jspb.test.TestClone.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestClone} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestClone} + */ +proto.jspb.test.TestClone.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStr(value); + break; + case 3: + var value = new proto.jspb.test.Simple1; + reader.readMessage(value,proto.jspb.test.Simple1.deserializeBinaryFromReader); + msg.setSimple1(value); + break; + case 5: + var value = new proto.jspb.test.Simple1; + reader.readMessage(value,proto.jspb.test.Simple1.deserializeBinaryFromReader); + msg.addSimple2(value); + break; + case 6: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBytesField(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setUnused(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.TestClone.extensionsBinary, + proto.jspb.test.TestClone.prototype.getExtension, + proto.jspb.test.TestClone.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestClone.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestClone.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestClone} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestClone.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getSimple1(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.jspb.test.Simple1.serializeBinaryToWriter + ); + } + f = message.getSimple2List(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + proto.jspb.test.Simple1.serializeBinaryToWriter + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeBytes( + 6, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeString( + 7, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.TestClone.extensionsBinary, proto.jspb.test.TestClone.prototype.getExtension); +}; + + +/** + * optional string str = 1; + * @return {string} + */ +proto.jspb.test.TestClone.prototype.getStr = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.setStr = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearStr = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestClone.prototype.hasStr = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Simple1 simple1 = 3; + * @return {?proto.jspb.test.Simple1} + */ +proto.jspb.test.TestClone.prototype.getSimple1 = function() { + return /** @type{?proto.jspb.test.Simple1} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Simple1, 3)); +}; + + +/** + * @param {?proto.jspb.test.Simple1|undefined} value + * @return {!proto.jspb.test.TestClone} returns this +*/ +proto.jspb.test.TestClone.prototype.setSimple1 = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearSimple1 = function() { + return this.setSimple1(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestClone.prototype.hasSimple1 = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated Simple1 simple2 = 5; + * @return {!Array} + */ +proto.jspb.test.TestClone.prototype.getSimple2List = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.Simple1, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.TestClone} returns this +*/ +proto.jspb.test.TestClone.prototype.setSimple2List = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 5, value); +}; + + +/** + * @param {!proto.jspb.test.Simple1=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.Simple1} + */ +proto.jspb.test.TestClone.prototype.addSimple2 = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.jspb.test.Simple1, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearSimple2List = function() { + return this.setSimple2List([]); +}; + + +/** + * optional bytes bytes_field = 6; + * @return {!(string|Uint8Array)} + */ +proto.jspb.test.TestClone.prototype.getBytesField = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * optional bytes bytes_field = 6; + * This is a type-conversion wrapper around `getBytesField()` + * @return {string} + */ +proto.jspb.test.TestClone.prototype.getBytesField_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBytesField())); +}; + + +/** + * optional bytes bytes_field = 6; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBytesField()` + * @return {!Uint8Array} + */ +proto.jspb.test.TestClone.prototype.getBytesField_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBytesField())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.setBytesField = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearBytesField = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestClone.prototype.hasBytesField = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional string unused = 7; + * @return {string} + */ +proto.jspb.test.TestClone.prototype.getUnused = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.setUnused = function(value) { + return jspb.Message.setField(this, 7, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearUnused = function() { + return jspb.Message.setField(this, 7, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestClone.prototype.hasUnused = function() { + return jspb.Message.getField(this, 7) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestCloneExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestCloneExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestCloneExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestCloneExtension.toObject = function(includeInstance, msg) { + var f, obj = { +f: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestCloneExtension} + */ +proto.jspb.test.TestCloneExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestCloneExtension; + return proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestCloneExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestCloneExtension} + */ +proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setF(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestCloneExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestCloneExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestCloneExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestCloneExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `lowExt`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.TestCloneExtension.lowExt = new jspb.ExtensionFieldInfo( + 11, + {lowExt: 0}, + proto.jspb.test.TestCloneExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.TestCloneExtension.toObject), + 0); + +proto.jspb.test.TestClone.extensionsBinary[11] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.TestCloneExtension.lowExt, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.TestCloneExtension.serializeBinaryToWriter, + proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestClone.extensions[11] = proto.jspb.test.TestCloneExtension.lowExt; + +/** + * optional int32 f = 1; + * @return {number} + */ +proto.jspb.test.TestCloneExtension.prototype.getF = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestCloneExtension} returns this + */ +proto.jspb.test.TestCloneExtension.prototype.setF = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestCloneExtension} returns this + */ +proto.jspb.test.TestCloneExtension.prototype.clearF = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestCloneExtension.prototype.hasF = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.CloneExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.CloneExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.CloneExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.CloneExtension.toObject = function(includeInstance, msg) { + var f, obj = { +ext: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.CloneExtension} + */ +proto.jspb.test.CloneExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.CloneExtension; + return proto.jspb.test.CloneExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.CloneExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.CloneExtension} + */ +proto.jspb.test.CloneExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setExt(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.CloneExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.CloneExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.CloneExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.CloneExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.CloneExtension.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + proto.jspb.test.CloneExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.CloneExtension.toObject), + 0); + +proto.jspb.test.TestClone.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.CloneExtension.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.CloneExtension.serializeBinaryToWriter, + proto.jspb.test.CloneExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestClone.extensions[100] = proto.jspb.test.CloneExtension.extField; + +/** + * optional string ext = 2; + * @return {string} + */ +proto.jspb.test.CloneExtension.prototype.getExt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.CloneExtension} returns this + */ +proto.jspb.test.CloneExtension.prototype.setExt = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.CloneExtension} returns this + */ +proto.jspb.test.CloneExtension.prototype.clearExt = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.CloneExtension.prototype.hasExt = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.TestGroup.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.toObject = function(includeInstance, msg) { + var f, obj = { +repeatedGroupList: jspb.Message.toObjectList(msg.getRepeatedGroupList(), + proto.jspb.test.TestGroup.RepeatedGroup.toObject, includeInstance), +requiredGroup: (f = msg.getRequiredGroup()) && proto.jspb.test.TestGroup.RequiredGroup.toObject(includeInstance, f), +optionalGroup: (f = msg.getOptionalGroup()) && proto.jspb.test.TestGroup.OptionalGroup.toObject(includeInstance, f), +id: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f, +requiredSimple: (f = msg.getRequiredSimple()) && proto.jspb.test.Simple2.toObject(includeInstance, f), +optionalSimple: (f = msg.getOptionalSimple()) && proto.jspb.test.Simple2.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup} + */ +proto.jspb.test.TestGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup; + return proto.jspb.test.TestGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup} + */ +proto.jspb.test.TestGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.jspb.test.TestGroup.RepeatedGroup; + reader.readGroup(1, value,proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader); + msg.addRepeatedGroup(value); + break; + case 2: + var value = new proto.jspb.test.TestGroup.RequiredGroup; + reader.readGroup(2, value,proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader); + msg.setRequiredGroup(value); + break; + case 3: + var value = new proto.jspb.test.TestGroup.OptionalGroup; + reader.readGroup(3, value,proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader); + msg.setOptionalGroup(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 5: + var value = new proto.jspb.test.Simple2; + reader.readMessage(value,proto.jspb.test.Simple2.deserializeBinaryFromReader); + msg.setRequiredSimple(value); + break; + case 6: + var value = new proto.jspb.test.Simple2; + reader.readMessage(value,proto.jspb.test.Simple2.deserializeBinaryFromReader); + msg.setOptionalSimple(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getRepeatedGroupList(); + if (f.length > 0) { + writer.writeRepeatedGroup( + 1, + f, + proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter + ); + } + f = message.getRequiredGroup(); + if (f != null) { + writer.writeGroup( + 2, + f, + proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter + ); + } + f = message.getOptionalGroup(); + if (f != null) { + writer.writeGroup( + 3, + f, + proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeString( + 4, + f + ); + } + f = message.getRequiredSimple(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.jspb.test.Simple2.serializeBinaryToWriter + ); + } + f = message.getOptionalSimple(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.jspb.test.Simple2.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.TestGroup.RepeatedGroup.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup.RepeatedGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.RepeatedGroup.toObject = function(includeInstance, msg) { + var f, obj = { +id: (f = jspb.Message.getField(msg, 0)) == null ? undefined : f, +someBoolList: (f = jspb.Message.getRepeatedBooleanField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + */ +proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup.RepeatedGroup; + return proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + */ +proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 2: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readBool() : [reader.readBool()]); + for (var i = 0; i < values.length; i++) { + msg.addSomeBool(values[i]); + } + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 0)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getSomeBoolList(); + if (f.length > 0) { + writer.writeRepeatedBool( + 2, + f + ); + } +}; + + +/** + * required string id = 1; + * @return {string} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 0, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.setId = function(value) { + return jspb.Message.setField(this, 0, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.clearId = function() { + return jspb.Message.setField(this, 0, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.hasId = function() { + return jspb.Message.getField(this, 0) != null; +}; + + +/** + * repeated bool some_bool = 2; + * @return {!Array} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.getSomeBoolList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.setSomeBoolList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {boolean} value + * @param {number=} opt_index + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.addSomeBool = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.clearSomeBoolList = function() { + return this.setSomeBoolList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup.RequiredGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup.RequiredGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.RequiredGroup.toObject = function(includeInstance, msg) { + var f, obj = { +id: (f = jspb.Message.getField(msg, -1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup.RequiredGroup} + */ +proto.jspb.test.TestGroup.RequiredGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup.RequiredGroup; + return proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup.RequiredGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup.RequiredGroup} + */ +proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup.RequiredGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, -1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * required string id = 1; + * @return {string} + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, -1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.setId = function(value) { + return jspb.Message.setField(this, -1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.clearId = function() { + return jspb.Message.setField(this, -1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.hasId = function() { + return jspb.Message.getField(this, -1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup.OptionalGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup.OptionalGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.OptionalGroup.toObject = function(includeInstance, msg) { + var f, obj = { +id: (f = jspb.Message.getField(msg, -2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup.OptionalGroup} + */ +proto.jspb.test.TestGroup.OptionalGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup.OptionalGroup; + return proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup.OptionalGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup.OptionalGroup} + */ +proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup.OptionalGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, -2)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * required string id = 1; + * @return {string} + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, -2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.setId = function(value) { + return jspb.Message.setField(this, -2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.clearId = function() { + return jspb.Message.setField(this, -2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.hasId = function() { + return jspb.Message.getField(this, -2) != null; +}; + + +/** + * repeated group RepeatedGroup = 1; + * @return {!Array} + */ +proto.jspb.test.TestGroup.prototype.getRepeatedGroupList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.TestGroup.RepeatedGroup, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setRepeatedGroupList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.jspb.test.TestGroup.RepeatedGroup=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + */ +proto.jspb.test.TestGroup.prototype.addRepeatedGroup = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.jspb.test.TestGroup.RepeatedGroup, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearRepeatedGroupList = function() { + return this.setRepeatedGroupList([]); +}; + + +/** + * required group RequiredGroup = 2; + * @return {!proto.jspb.test.TestGroup.RequiredGroup} + */ +proto.jspb.test.TestGroup.prototype.getRequiredGroup = function() { + return /** @type{!proto.jspb.test.TestGroup.RequiredGroup} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestGroup.RequiredGroup, 2, 1)); +}; + + +/** + * @param {!proto.jspb.test.TestGroup.RequiredGroup} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setRequiredGroup = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearRequiredGroup = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasRequiredGroup = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional group OptionalGroup = 3; + * @return {?proto.jspb.test.TestGroup.OptionalGroup} + */ +proto.jspb.test.TestGroup.prototype.getOptionalGroup = function() { + return /** @type{?proto.jspb.test.TestGroup.OptionalGroup} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestGroup.OptionalGroup, 3)); +}; + + +/** + * @param {?proto.jspb.test.TestGroup.OptionalGroup|undefined} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setOptionalGroup = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearOptionalGroup = function() { + return this.setOptionalGroup(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasOptionalGroup = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional string id = 4; + * @return {string} + */ +proto.jspb.test.TestGroup.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.setId = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearId = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasId = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * required Simple2 required_simple = 5; + * @return {!proto.jspb.test.Simple2} + */ +proto.jspb.test.TestGroup.prototype.getRequiredSimple = function() { + return /** @type{!proto.jspb.test.Simple2} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Simple2, 5, 1)); +}; + + +/** + * @param {!proto.jspb.test.Simple2} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setRequiredSimple = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearRequiredSimple = function() { + return jspb.Message.setField(this, 5, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasRequiredSimple = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional Simple2 optional_simple = 6; + * @return {?proto.jspb.test.Simple2} + */ +proto.jspb.test.TestGroup.prototype.getOptionalSimple = function() { + return /** @type{?proto.jspb.test.Simple2} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Simple2, 6)); +}; + + +/** + * @param {?proto.jspb.test.Simple2|undefined} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setOptionalSimple = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearOptionalSimple = function() { + return this.setOptionalSimple(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasOptionalSimple = function() { + return jspb.Message.getField(this, 6) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup1.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup1.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup1} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup1.toObject = function(includeInstance, msg) { + var f, obj = { +group: (f = msg.getGroup()) && proto.jspb.test.TestGroup.RepeatedGroup.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup1} + */ +proto.jspb.test.TestGroup1.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup1; + return proto.jspb.test.TestGroup1.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup1} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup1} + */ +proto.jspb.test.TestGroup1.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.jspb.test.TestGroup.RepeatedGroup; + reader.readMessage(value,proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader); + msg.setGroup(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup1.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup1.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup1} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup1.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getGroup(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter + ); + } +}; + + +/** + * optional TestGroup.RepeatedGroup group = 1; + * @return {?proto.jspb.test.TestGroup.RepeatedGroup} + */ +proto.jspb.test.TestGroup1.prototype.getGroup = function() { + return /** @type{?proto.jspb.test.TestGroup.RepeatedGroup} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestGroup.RepeatedGroup, 1)); +}; + + +/** + * @param {?proto.jspb.test.TestGroup.RepeatedGroup|undefined} value + * @return {!proto.jspb.test.TestGroup1} returns this +*/ +proto.jspb.test.TestGroup1.prototype.setGroup = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestGroup1} returns this + */ +proto.jspb.test.TestGroup1.prototype.clearGroup = function() { + return this.setGroup(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup1.prototype.hasGroup = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestReservedNames.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestReservedNames.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestReservedNames} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestReservedNames.toObject = function(includeInstance, msg) { + var f, obj = { +extension: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.TestReservedNames.extensions, proto.jspb.test.TestReservedNames.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestReservedNames} + */ +proto.jspb.test.TestReservedNames.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestReservedNames; + return proto.jspb.test.TestReservedNames.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestReservedNames} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestReservedNames} + */ +proto.jspb.test.TestReservedNames.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setExtension$(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.TestReservedNames.extensionsBinary, + proto.jspb.test.TestReservedNames.prototype.getExtension, + proto.jspb.test.TestReservedNames.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestReservedNames.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestReservedNames.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestReservedNames} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestReservedNames.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.TestReservedNames.extensionsBinary, proto.jspb.test.TestReservedNames.prototype.getExtension); +}; + + +/** + * optional int32 extension = 1; + * @return {number} + */ +proto.jspb.test.TestReservedNames.prototype.getExtension$ = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestReservedNames} returns this + */ +proto.jspb.test.TestReservedNames.prototype.setExtension$ = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestReservedNames} returns this + */ +proto.jspb.test.TestReservedNames.prototype.clearExtension$ = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestReservedNames.prototype.hasExtension$ = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestReservedNamesExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestReservedNamesExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestReservedNamesExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestReservedNamesExtension.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestReservedNamesExtension} + */ +proto.jspb.test.TestReservedNamesExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestReservedNamesExtension; + return proto.jspb.test.TestReservedNamesExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestReservedNamesExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestReservedNamesExtension} + */ +proto.jspb.test.TestReservedNamesExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestReservedNamesExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestReservedNamesExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestReservedNamesExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestReservedNamesExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `foo`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( + 10, + {foo: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.TestReservedNames.extensionsBinary[10] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.TestReservedNamesExtension.foo, + jspb.BinaryReader.prototype.readInt32, + jspb.BinaryWriter.prototype.writeInt32, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestReservedNames.extensions[10] = proto.jspb.test.TestReservedNamesExtension.foo; + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.TestMessageWithOneof.repeatedFields_ = [9]; + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.jspb.test.TestMessageWithOneof.oneofGroups_ = [[3,5],[6,7],[10,11],[12,13]]; + +/** + * @enum {number} + */ +proto.jspb.test.TestMessageWithOneof.PartialOneofCase = { + PARTIAL_ONEOF_NOT_SET: 0, + PONE: 3, + PTHREE: 5 +}; + +/** + * @return {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getPartialOneofCase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0])); +}; + +/** + * @enum {number} + */ +proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase = { + RECURSIVE_ONEOF_NOT_SET: 0, + RONE: 6, + RTWO: 7 +}; + +/** + * @return {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getRecursiveOneofCase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1])); +}; + +/** + * @enum {number} + */ +proto.jspb.test.TestMessageWithOneof.DefaultOneofACase = { + DEFAULT_ONEOF_A_NOT_SET: 0, + AONE: 10, + ATWO: 11 +}; + +/** + * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getDefaultOneofACase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2])); +}; + +/** + * @enum {number} + */ +proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase = { + DEFAULT_ONEOF_B_NOT_SET: 0, + BONE: 12, + BTWO: 13 +}; + +/** + * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getDefaultOneofBCase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestMessageWithOneof.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestMessageWithOneof.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestMessageWithOneof} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestMessageWithOneof.toObject = function(includeInstance, msg) { + var f, obj = { +pone: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, +pthree: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f, +rone: (f = msg.getRone()) && proto.jspb.test.TestMessageWithOneof.toObject(includeInstance, f), +rtwo: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f, +normalField: (f = jspb.Message.getBooleanField(msg, 8)) == null ? undefined : f, +repeatedFieldList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f, +aone: jspb.Message.getFieldWithDefault(msg, 10, 1234), +atwo: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f, +bone: (f = jspb.Message.getField(msg, 12)) == null ? undefined : f, +btwo: jspb.Message.getFieldWithDefault(msg, 13, 1234) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestMessageWithOneof} + */ +proto.jspb.test.TestMessageWithOneof.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestMessageWithOneof; + return proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestMessageWithOneof} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestMessageWithOneof} + */ +proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setPone(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setPthree(value); + break; + case 6: + var value = new proto.jspb.test.TestMessageWithOneof; + reader.readMessage(value,proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader); + msg.setRone(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setRtwo(value); + break; + case 8: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setNormalField(value); + break; + case 9: + var value = /** @type {string} */ (reader.readString()); + msg.addRepeatedField(value); + break; + case 10: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAone(value); + break; + case 11: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAtwo(value); + break; + case 12: + var value = /** @type {number} */ (reader.readInt32()); + msg.setBone(value); + break; + case 13: + var value = /** @type {number} */ (reader.readInt32()); + msg.setBtwo(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestMessageWithOneof.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestMessageWithOneof} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeString( + 5, + f + ); + } + f = message.getRone(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeString( + 7, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeBool( + 8, + f + ); + } + f = message.getRepeatedFieldList(); + if (f.length > 0) { + writer.writeRepeatedString( + 9, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeInt32( + 10, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 11)); + if (f != null) { + writer.writeInt32( + 11, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 12)); + if (f != null) { + writer.writeInt32( + 12, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 13)); + if (f != null) { + writer.writeInt32( + 13, + f + ); + } +}; + + +/** + * optional string pone = 3; + * @return {string} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getPone = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setPone = function(value) { + return jspb.Message.setOneofField(this, 3, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearPone = function() { + return jspb.Message.setOneofField(this, 3, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasPone = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional string pthree = 5; + * @return {string} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getPthree = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setPthree = function(value) { + return jspb.Message.setOneofField(this, 5, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearPthree = function() { + return jspb.Message.setOneofField(this, 5, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasPthree = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional TestMessageWithOneof rone = 6; + * @return {?proto.jspb.test.TestMessageWithOneof} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getRone = function() { + return /** @type{?proto.jspb.test.TestMessageWithOneof} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestMessageWithOneof, 6)); +}; + + +/** + * @param {?proto.jspb.test.TestMessageWithOneof|undefined} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this +*/ +proto.jspb.test.TestMessageWithOneof.prototype.setRone = function(value) { + return jspb.Message.setOneofWrapperField(this, 6, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearRone = function() { + return this.setRone(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasRone = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional string rtwo = 7; + * @return {string} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getRtwo = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setRtwo = function(value) { + return jspb.Message.setOneofField(this, 7, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearRtwo = function() { + return jspb.Message.setOneofField(this, 7, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasRtwo = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional bool normal_field = 8; + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getNormalField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setNormalField = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearNormalField = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasNormalField = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * repeated string repeated_field = 9; + * @return {!Array} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getRepeatedFieldList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 9)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setRepeatedFieldList = function(value) { + return jspb.Message.setField(this, 9, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.addRepeatedField = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 9, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearRepeatedFieldList = function() { + return this.setRepeatedFieldList([]); +}; + + +/** + * optional int32 aone = 10; + * @return {number} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getAone = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 10, 1234)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setAone = function(value) { + return jspb.Message.setOneofField(this, 10, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearAone = function() { + return jspb.Message.setOneofField(this, 10, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasAone = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * optional int32 atwo = 11; + * @return {number} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getAtwo = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setAtwo = function(value) { + return jspb.Message.setOneofField(this, 11, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearAtwo = function() { + return jspb.Message.setOneofField(this, 11, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasAtwo = function() { + return jspb.Message.getField(this, 11) != null; +}; + + +/** + * optional int32 bone = 12; + * @return {number} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getBone = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 12, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setBone = function(value) { + return jspb.Message.setOneofField(this, 12, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearBone = function() { + return jspb.Message.setOneofField(this, 12, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasBone = function() { + return jspb.Message.getField(this, 12) != null; +}; + + +/** + * optional int32 btwo = 13; + * @return {number} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getBtwo = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 1234)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setBtwo = function(value) { + return jspb.Message.setOneofField(this, 13, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearBtwo = function() { + return jspb.Message.setOneofField(this, 13, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasBtwo = function() { + return jspb.Message.getField(this, 13) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestEndsWithBytes.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestEndsWithBytes.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestEndsWithBytes} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestEndsWithBytes.toObject = function(includeInstance, msg) { + var f, obj = { +value: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestEndsWithBytes} + */ +proto.jspb.test.TestEndsWithBytes.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestEndsWithBytes; + return proto.jspb.test.TestEndsWithBytes.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestEndsWithBytes} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestEndsWithBytes} + */ +proto.jspb.test.TestEndsWithBytes.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setValue(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestEndsWithBytes.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestEndsWithBytes.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestEndsWithBytes} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestEndsWithBytes.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional int32 value = 1; + * @return {number} + */ +proto.jspb.test.TestEndsWithBytes.prototype.getValue = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ +proto.jspb.test.TestEndsWithBytes.prototype.setValue = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ +proto.jspb.test.TestEndsWithBytes.prototype.clearValue = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestEndsWithBytes.prototype.hasValue = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bytes data = 2; + * @return {!(string|Uint8Array)} + */ +proto.jspb.test.TestEndsWithBytes.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes data = 2; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.jspb.test.TestEndsWithBytes.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.jspb.test.TestEndsWithBytes.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ +proto.jspb.test.TestEndsWithBytes.prototype.setData = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ +proto.jspb.test.TestEndsWithBytes.prototype.clearData = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestEndsWithBytes.prototype.hasData = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestLastFieldBeforePivot.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestLastFieldBeforePivot} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestLastFieldBeforePivot.toObject = function(includeInstance, msg) { + var f, obj = { +lastFieldBeforePivot: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.TestLastFieldBeforePivot.extensions, proto.jspb.test.TestLastFieldBeforePivot.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestLastFieldBeforePivot} + */ +proto.jspb.test.TestLastFieldBeforePivot.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestLastFieldBeforePivot; + return proto.jspb.test.TestLastFieldBeforePivot.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestLastFieldBeforePivot} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestLastFieldBeforePivot} + */ +proto.jspb.test.TestLastFieldBeforePivot.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setLastFieldBeforePivot(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary, + proto.jspb.test.TestLastFieldBeforePivot.prototype.getExtension, + proto.jspb.test.TestLastFieldBeforePivot.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestLastFieldBeforePivot.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestLastFieldBeforePivot} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestLastFieldBeforePivot.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary, proto.jspb.test.TestLastFieldBeforePivot.prototype.getExtension); +}; + + +/** + * optional int32 last_field_before_pivot = 1; + * @return {number} + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.getLastFieldBeforePivot = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.setLastFieldBeforePivot = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.clearLastFieldBeforePivot = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.hasLastFieldBeforePivot = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Int64Types.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Int64Types.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Int64Types} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Int64Types.toObject = function(includeInstance, msg) { + var f, obj = { +int64Normal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +int64String: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, +int64Number: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Int64Types} + */ +proto.jspb.test.Int64Types.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Int64Types; + return proto.jspb.test.Int64Types.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Int64Types} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Int64Types} + */ +proto.jspb.test.Int64Types.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setInt64Normal(value); + break; + case 2: + var value = /** @type {string} */ (reader.readSint64String()); + msg.setInt64String(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setInt64Number(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Int64Types.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Int64Types.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Int64Types} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Int64Types.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt64( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeSint64String( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeUint64( + 3, + f + ); + } +}; + + +/** + * optional int64 int64_normal = 1; + * @return {number} + */ +proto.jspb.test.Int64Types.prototype.getInt64Normal = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.setInt64Normal = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.clearInt64Normal = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Int64Types.prototype.hasInt64Normal = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional sint64 int64_string = 2; + * @return {string} + */ +proto.jspb.test.Int64Types.prototype.getInt64String = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.setInt64String = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.clearInt64String = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Int64Types.prototype.hasInt64String = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional uint64 int64_number = 3; + * @return {number} + */ +proto.jspb.test.Int64Types.prototype.getInt64Number = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.setInt64Number = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.clearInt64Number = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Int64Types.prototype.hasInt64Number = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestMapFieldsNoBinary.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestMapFieldsNoBinary} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestMapFieldsNoBinary.toObject = function(includeInstance, msg) { + var f, obj = { +mapStringStringMap: (f = msg.getMapStringStringMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringInt32Map: (f = msg.getMapStringInt32Map()) ? f.toObject(includeInstance, undefined) : [], +mapStringInt64Map: (f = msg.getMapStringInt64Map()) ? f.toObject(includeInstance, undefined) : [], +mapStringBoolMap: (f = msg.getMapStringBoolMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringDoubleMap: (f = msg.getMapStringDoubleMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringEnumMap: (f = msg.getMapStringEnumMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringMsgMap: (f = msg.getMapStringMsgMap()) ? f.toObject(includeInstance, proto.jspb.test.MapValueMessageNoBinary.toObject) : [], +mapInt32StringMap: (f = msg.getMapInt32StringMap()) ? f.toObject(includeInstance, undefined) : [], +mapInt64StringMap: (f = msg.getMapInt64StringMap()) ? f.toObject(includeInstance, undefined) : [], +mapBoolStringMap: (f = msg.getMapBoolStringMap()) ? f.toObject(includeInstance, undefined) : [], +testMapFields: (f = msg.getTestMapFields()) && proto.jspb.test.TestMapFieldsNoBinary.toObject(includeInstance, f), +mapStringTestmapfieldsMap: (f = msg.getMapStringTestmapfieldsMap()) ? f.toObject(includeInstance, proto.jspb.test.TestMapFieldsNoBinary.toObject) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} + */ +proto.jspb.test.TestMapFieldsNoBinary.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestMapFieldsNoBinary; + return proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestMapFieldsNoBinary} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} + */ +proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getMapStringStringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); + }); + break; + case 2: + var value = msg.getMapStringInt32Map(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt32, null, "", 0); + }); + break; + case 3: + var value = msg.getMapStringInt64Map(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt64, null, "", 0); + }); + break; + case 4: + var value = msg.getMapStringBoolMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readBool, null, "", false); + }); + break; + case 5: + var value = msg.getMapStringDoubleMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readDouble, null, "", 0.0); + }); + break; + case 6: + var value = msg.getMapStringEnumMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readEnum, null, "", 0); + }); + break; + case 7: + var value = msg.getMapStringMsgMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader, "", new proto.jspb.test.MapValueMessageNoBinary()); + }); + break; + case 8: + var value = msg.getMapInt32StringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt32, jspb.BinaryReader.prototype.readString, null, 0, ""); + }); + break; + case 9: + var value = msg.getMapInt64StringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt64, jspb.BinaryReader.prototype.readString, null, 0, ""); + }); + break; + case 10: + var value = msg.getMapBoolStringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readBool, jspb.BinaryReader.prototype.readString, null, false, ""); + }); + break; + case 11: + var value = new proto.jspb.test.TestMapFieldsNoBinary; + reader.readMessage(value,proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader); + msg.setTestMapFields(value); + break; + case 12: + var value = msg.getMapStringTestmapfieldsMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader, "", new proto.jspb.test.TestMapFieldsNoBinary()); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestMapFieldsNoBinary} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMapStringStringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); + } + f = message.getMapStringInt32Map(true); + if (f && f.getLength() > 0) { + f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt32); + } + f = message.getMapStringInt64Map(true); + if (f && f.getLength() > 0) { + f.serializeBinary(3, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt64); + } + f = message.getMapStringBoolMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(4, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeBool); + } + f = message.getMapStringDoubleMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(5, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeDouble); + } + f = message.getMapStringEnumMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(6, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeEnum); + } + f = message.getMapStringMsgMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(7, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter); + } + f = message.getMapInt32StringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(8, writer, jspb.BinaryWriter.prototype.writeInt32, jspb.BinaryWriter.prototype.writeString); + } + f = message.getMapInt64StringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(9, writer, jspb.BinaryWriter.prototype.writeInt64, jspb.BinaryWriter.prototype.writeString); + } + f = message.getMapBoolStringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(10, writer, jspb.BinaryWriter.prototype.writeBool, jspb.BinaryWriter.prototype.writeString); + } + f = message.getTestMapFields(); + if (f != null) { + writer.writeMessage( + 11, + f, + proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter + ); + } + f = message.getMapStringTestmapfieldsMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(12, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter); + } +}; + + +/** + * map map_string_string = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringStringMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringStringMap = function() { + this.getMapStringStringMap().clear(); + return this; +}; + + +/** + * map map_string_int32 = 2; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringInt32Map = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 2, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringInt32Map = function() { + this.getMapStringInt32Map().clear(); + return this; +}; + + +/** + * map map_string_int64 = 3; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringInt64Map = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 3, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringInt64Map = function() { + this.getMapStringInt64Map().clear(); + return this; +}; + + +/** + * map map_string_bool = 4; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringBoolMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 4, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringBoolMap = function() { + this.getMapStringBoolMap().clear(); + return this; +}; + + +/** + * map map_string_double = 5; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringDoubleMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 5, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringDoubleMap = function() { + this.getMapStringDoubleMap().clear(); + return this; +}; + + +/** + * map map_string_enum = 6; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringEnumMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 6, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringEnumMap = function() { + this.getMapStringEnumMap().clear(); + return this; +}; + + +/** + * map map_string_msg = 7; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringMsgMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 7, opt_noLazyCreate, + proto.jspb.test.MapValueMessageNoBinary)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringMsgMap = function() { + this.getMapStringMsgMap().clear(); + return this; +}; + + +/** + * map map_int32_string = 8; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapInt32StringMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 8, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapInt32StringMap = function() { + this.getMapInt32StringMap().clear(); + return this; +}; + + +/** + * map map_int64_string = 9; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapInt64StringMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 9, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapInt64StringMap = function() { + this.getMapInt64StringMap().clear(); + return this; +}; + + +/** + * map map_bool_string = 10; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapBoolStringMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 10, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapBoolStringMap = function() { + this.getMapBoolStringMap().clear(); + return this; +}; + + +/** + * optional TestMapFieldsNoBinary test_map_fields = 11; + * @return {?proto.jspb.test.TestMapFieldsNoBinary} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getTestMapFields = function() { + return /** @type{?proto.jspb.test.TestMapFieldsNoBinary} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestMapFieldsNoBinary, 11)); +}; + + +/** + * @param {?proto.jspb.test.TestMapFieldsNoBinary|undefined} value + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this +*/ +proto.jspb.test.TestMapFieldsNoBinary.prototype.setTestMapFields = function(value) { + return jspb.Message.setWrapperField(this, 11, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearTestMapFields = function() { + return this.setTestMapFields(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.hasTestMapFields = function() { + return jspb.Message.getField(this, 11) != null; +}; + + +/** + * map map_string_testmapfields = 12; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringTestmapfieldsMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 12, opt_noLazyCreate, + proto.jspb.test.TestMapFieldsNoBinary)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringTestmapfieldsMap = function() { + this.getMapStringTestmapfieldsMap().clear(); + return this; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.MapValueMessageNoBinary.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.MapValueMessageNoBinary} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.MapValueMessageNoBinary.toObject = function(includeInstance, msg) { + var f, obj = { +foo: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.MapValueMessageNoBinary} + */ +proto.jspb.test.MapValueMessageNoBinary.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.MapValueMessageNoBinary; + return proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.MapValueMessageNoBinary} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.MapValueMessageNoBinary} + */ +proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setFoo(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.MapValueMessageNoBinary} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 foo = 1; + * @return {number} + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.getFoo = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.setFoo = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.clearFoo = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.hasFoo = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Deeply.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Deeply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Deeply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Deeply} + */ +proto.jspb.test.Deeply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Deeply; + return proto.jspb.test.Deeply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Deeply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Deeply} + */ +proto.jspb.test.Deeply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Deeply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Deeply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Deeply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Deeply.Nested.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Deeply.Nested.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Deeply.Nested} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.Nested.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Deeply.Nested} + */ +proto.jspb.test.Deeply.Nested.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Deeply.Nested; + return proto.jspb.test.Deeply.Nested.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Deeply.Nested} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Deeply.Nested} + */ +proto.jspb.test.Deeply.Nested.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Deeply.Nested.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Deeply.Nested.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Deeply.Nested} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.Nested.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Deeply.Nested.Message.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Deeply.Nested.Message.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Deeply.Nested.Message} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.Nested.Message.toObject = function(includeInstance, msg) { + var f, obj = { +count: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Deeply.Nested.Message} + */ +proto.jspb.test.Deeply.Nested.Message.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Deeply.Nested.Message; + return proto.jspb.test.Deeply.Nested.Message.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Deeply.Nested.Message} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Deeply.Nested.Message} + */ +proto.jspb.test.Deeply.Nested.Message.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setCount(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Deeply.Nested.Message.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Deeply.Nested.Message.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Deeply.Nested.Message} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.Nested.Message.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 count = 1; + * @return {number} + */ +proto.jspb.test.Deeply.Nested.Message.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Deeply.Nested.Message} returns this + */ +proto.jspb.test.Deeply.Nested.Message.prototype.setCount = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Deeply.Nested.Message} returns this + */ +proto.jspb.test.Deeply.Nested.Message.prototype.clearCount = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Deeply.Nested.Message.prototype.hasCount = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * @enum {number} + */ +proto.jspb.test.OuterEnum = { + FOO: 1, + BAR: 2 +}; + +/** + * @enum {number} + */ +proto.jspb.test.MapValueEnumNoBinary = { + MAP_VALUE_FOO_NOBINARY: 0, + MAP_VALUE_BAR_NOBINARY: 1, + MAP_VALUE_BAZ_NOBINARY: 2 +}; + +/** + * @enum {number} + */ +proto.jspb.test.TestAllowAliasEnum = { + TEST_ALLOW_ALIAS_DEFAULT: 0, + VALUE1: 1 +}; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `simple1`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.simple1 = new jspb.ExtensionFieldInfo( + 105, + {simple1: 0}, + proto.jspb.test.Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.Simple1.toObject), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[105] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.simple1, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.Simple1.serializeBinaryToWriter, + proto.jspb.test.Simple1.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[105] = proto.jspb.test.simple1; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extendTestLastFieldBeforePivotField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.extendTestLastFieldBeforePivotField = new jspb.ExtensionFieldInfo( + 101, + {extendTestLastFieldBeforePivotField: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.extendTestLastFieldBeforePivotField, + jspb.BinaryReader.prototype.readInt32, + jspb.BinaryWriter.prototype.writeInt32, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestLastFieldBeforePivot.extensions[101] = proto.jspb.test.extendTestLastFieldBeforePivotField; + diff --git a/example/test.closure-old.js b/example/test.closure-old.js new file mode 100644 index 00000000..d1f8d940 --- /dev/null +++ b/example/test.closure-old.js @@ -0,0 +1,9724 @@ +// source: test.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + + +goog.provide('proto.jspb.test.BooleanFields'); +goog.provide('proto.jspb.test.CloneExtension'); +goog.provide('proto.jspb.test.Complex'); +goog.provide('proto.jspb.test.Complex.Nested'); +goog.provide('proto.jspb.test.Deeply'); +goog.provide('proto.jspb.test.Deeply.Nested'); +goog.provide('proto.jspb.test.Deeply.Nested.Message'); +goog.provide('proto.jspb.test.DefaultValues'); +goog.provide('proto.jspb.test.DefaultValues.Enum'); +goog.provide('proto.jspb.test.Empty'); +goog.provide('proto.jspb.test.EnumContainer'); +goog.provide('proto.jspb.test.FloatingPointFields'); +goog.provide('proto.jspb.test.HasExtensions'); +goog.provide('proto.jspb.test.IndirectExtension'); +goog.provide('proto.jspb.test.Int64Types'); +goog.provide('proto.jspb.test.IsExtension'); +goog.provide('proto.jspb.test.MapValueEnumNoBinary'); +goog.provide('proto.jspb.test.MapValueMessageNoBinary'); +goog.provide('proto.jspb.test.MineField'); +goog.provide('proto.jspb.test.OptionalFields'); +goog.provide('proto.jspb.test.OptionalFields.Nested'); +goog.provide('proto.jspb.test.OuterEnum'); +goog.provide('proto.jspb.test.OuterMessage'); +goog.provide('proto.jspb.test.OuterMessage.Complex'); +goog.provide('proto.jspb.test.Simple1'); +goog.provide('proto.jspb.test.Simple2'); +goog.provide('proto.jspb.test.SpecialCases'); +goog.provide('proto.jspb.test.TestAllowAliasEnum'); +goog.provide('proto.jspb.test.TestClone'); +goog.provide('proto.jspb.test.TestCloneExtension'); +goog.provide('proto.jspb.test.TestEndsWithBytes'); +goog.provide('proto.jspb.test.TestGroup'); +goog.provide('proto.jspb.test.TestGroup.OptionalGroup'); +goog.provide('proto.jspb.test.TestGroup.RepeatedGroup'); +goog.provide('proto.jspb.test.TestGroup.RequiredGroup'); +goog.provide('proto.jspb.test.TestGroup1'); +goog.provide('proto.jspb.test.TestLastFieldBeforePivot'); +goog.provide('proto.jspb.test.TestMapFieldsNoBinary'); +goog.provide('proto.jspb.test.TestMessageWithOneof'); +goog.provide('proto.jspb.test.TestMessageWithOneof.DefaultOneofACase'); +goog.provide('proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase'); +goog.provide('proto.jspb.test.TestMessageWithOneof.PartialOneofCase'); +goog.provide('proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase'); +goog.provide('proto.jspb.test.TestReservedNames'); +goog.provide('proto.jspb.test.TestReservedNamesExtension'); +goog.provide('proto.jspb.test.extendTestLastFieldBeforePivotField'); +goog.provide('proto.jspb.test.simple1'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.ExtensionFieldBinaryInfo'); +goog.require('jspb.ExtensionFieldInfo'); +goog.require('jspb.Map'); +goog.require('jspb.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Empty = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Empty, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Empty.displayName = 'proto.jspb.test.Empty'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.EnumContainer = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.EnumContainer, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.EnumContainer.displayName = 'proto.jspb.test.EnumContainer'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Simple1 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.Simple1.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.Simple1, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Simple1.displayName = 'proto.jspb.test.Simple1'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Simple2 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.Simple2.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.Simple2, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Simple2.displayName = 'proto.jspb.test.Simple2'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.SpecialCases = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.SpecialCases, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.SpecialCases.displayName = 'proto.jspb.test.SpecialCases'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.OptionalFields = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.OptionalFields.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.OptionalFields, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.OptionalFields.displayName = 'proto.jspb.test.OptionalFields'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.OptionalFields.Nested = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.OptionalFields.Nested, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.OptionalFields.Nested.displayName = 'proto.jspb.test.OptionalFields.Nested'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.HasExtensions = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 4, null, null); +}; +goog.inherits(proto.jspb.test.HasExtensions, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.HasExtensions.displayName = 'proto.jspb.test.HasExtensions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.HasExtensions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.HasExtensions.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Complex = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.Complex.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.Complex, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Complex.displayName = 'proto.jspb.test.Complex'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Complex.Nested = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Complex.Nested, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Complex.Nested.displayName = 'proto.jspb.test.Complex.Nested'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.OuterMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.OuterMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.OuterMessage.displayName = 'proto.jspb.test.OuterMessage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.OuterMessage.Complex = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.OuterMessage.Complex, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.OuterMessage.Complex.displayName = 'proto.jspb.test.OuterMessage.Complex'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.MineField = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.MineField, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.MineField.displayName = 'proto.jspb.test.MineField'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.IsExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.IsExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.IsExtension.displayName = 'proto.jspb.test.IsExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.IndirectExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.IndirectExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.IndirectExtension.displayName = 'proto.jspb.test.IndirectExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.DefaultValues = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.DefaultValues, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.DefaultValues.displayName = 'proto.jspb.test.DefaultValues'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.FloatingPointFields = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.FloatingPointFields.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.FloatingPointFields, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.FloatingPointFields.displayName = 'proto.jspb.test.FloatingPointFields'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.BooleanFields = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.BooleanFields.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.BooleanFields, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.BooleanFields.displayName = 'proto.jspb.test.BooleanFields'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestClone = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 8, proto.jspb.test.TestClone.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.TestClone, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestClone.displayName = 'proto.jspb.test.TestClone'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestClone.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestClone.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestCloneExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestCloneExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestCloneExtension.displayName = 'proto.jspb.test.TestCloneExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.CloneExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.CloneExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.CloneExtension.displayName = 'proto.jspb.test.CloneExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.TestGroup.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.TestGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup.displayName = 'proto.jspb.test.TestGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup.RepeatedGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.TestGroup.RepeatedGroup.repeatedFields_, null); +}; +goog.inherits(proto.jspb.test.TestGroup.RepeatedGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup.RepeatedGroup.displayName = 'proto.jspb.test.TestGroup.RepeatedGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup.RequiredGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestGroup.RequiredGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup.RequiredGroup.displayName = 'proto.jspb.test.TestGroup.RequiredGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup.OptionalGroup = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestGroup.OptionalGroup, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup.OptionalGroup.displayName = 'proto.jspb.test.TestGroup.OptionalGroup'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestGroup1 = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestGroup1, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestGroup1.displayName = 'proto.jspb.test.TestGroup1'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestReservedNames = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); +}; +goog.inherits(proto.jspb.test.TestReservedNames, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestReservedNames.displayName = 'proto.jspb.test.TestReservedNames'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestReservedNames.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestReservedNames.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestReservedNamesExtension = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestReservedNamesExtension, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestReservedNamesExtension.displayName = 'proto.jspb.test.TestReservedNamesExtension'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestMessageWithOneof = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.jspb.test.TestMessageWithOneof.repeatedFields_, proto.jspb.test.TestMessageWithOneof.oneofGroups_); +}; +goog.inherits(proto.jspb.test.TestMessageWithOneof, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestMessageWithOneof.displayName = 'proto.jspb.test.TestMessageWithOneof'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestEndsWithBytes = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestEndsWithBytes, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestEndsWithBytes.displayName = 'proto.jspb.test.TestEndsWithBytes'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestLastFieldBeforePivot = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); +}; +goog.inherits(proto.jspb.test.TestLastFieldBeforePivot, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestLastFieldBeforePivot.displayName = 'proto.jspb.test.TestLastFieldBeforePivot'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestLastFieldBeforePivot.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Int64Types = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Int64Types, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Int64Types.displayName = 'proto.jspb.test.Int64Types'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestMapFieldsNoBinary = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.TestMapFieldsNoBinary, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestMapFieldsNoBinary.displayName = 'proto.jspb.test.TestMapFieldsNoBinary'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.MapValueMessageNoBinary = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.MapValueMessageNoBinary, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.MapValueMessageNoBinary.displayName = 'proto.jspb.test.MapValueMessageNoBinary'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Deeply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Deeply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Deeply.displayName = 'proto.jspb.test.Deeply'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Deeply.Nested = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Deeply.Nested, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Deeply.Nested.displayName = 'proto.jspb.test.Deeply.Nested'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.Deeply.Nested.Message = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.Deeply.Nested.Message, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.Deeply.Nested.Message.displayName = 'proto.jspb.test.Deeply.Nested.Message'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Empty.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Empty.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Empty} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Empty.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Empty} + */ +proto.jspb.test.Empty.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Empty; + return proto.jspb.test.Empty.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Empty} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Empty} + */ +proto.jspb.test.Empty.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Empty.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Empty.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Empty} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Empty.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.EnumContainer.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.EnumContainer.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.EnumContainer} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.EnumContainer.toObject = function(includeInstance, msg) { + var f, obj = { +outerEnum: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.EnumContainer} + */ +proto.jspb.test.EnumContainer.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.EnumContainer; + return proto.jspb.test.EnumContainer.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.EnumContainer} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.EnumContainer} + */ +proto.jspb.test.EnumContainer.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.jspb.test.OuterEnum} */ (reader.readEnum()); + msg.setOuterEnum(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.EnumContainer.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.EnumContainer.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.EnumContainer} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.EnumContainer.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeEnum( + 1, + f + ); + } +}; + + +/** + * optional OuterEnum outer_enum = 1; + * @return {!proto.jspb.test.OuterEnum} + */ +proto.jspb.test.EnumContainer.prototype.getOuterEnum = function() { + return /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getFieldWithDefault(this, 1, 1)); +}; + + +/** + * @param {!proto.jspb.test.OuterEnum} value + * @return {!proto.jspb.test.EnumContainer} returns this + */ +proto.jspb.test.EnumContainer.prototype.setOuterEnum = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.EnumContainer} returns this + */ +proto.jspb.test.EnumContainer.prototype.clearOuterEnum = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.EnumContainer.prototype.hasOuterEnum = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.Simple1.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Simple1.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Simple1.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Simple1} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Simple1.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f, +aBoolean: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Simple1} + */ +proto.jspb.test.Simple1.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Simple1; + return proto.jspb.test.Simple1.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Simple1} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Simple1} + */ +proto.jspb.test.Simple1.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setABoolean(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Simple1.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Simple1.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Simple1} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Simple1.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeBool( + 3, + f + ); + } +}; + + +/** + * required string a_string = 1; + * @return {string} + */ +proto.jspb.test.Simple1.prototype.getAString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.setAString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.clearAString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Simple1.prototype.hasAString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated string a_repeated_string = 2; + * @return {!Array} + */ +proto.jspb.test.Simple1.prototype.getARepeatedStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.setARepeatedStringList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.addARepeatedString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.clearARepeatedStringList = function() { + return this.setARepeatedStringList([]); +}; + + +/** + * optional bool a_boolean = 3; + * @return {boolean} + */ +proto.jspb.test.Simple1.prototype.getABoolean = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.setABoolean = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Simple1} returns this + */ +proto.jspb.test.Simple1.prototype.clearABoolean = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Simple1.prototype.hasABoolean = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.Simple2.repeatedFields_ = [2]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Simple2.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Simple2.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Simple2} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Simple2.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Simple2} + */ +proto.jspb.test.Simple2.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Simple2; + return proto.jspb.test.Simple2.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Simple2} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Simple2} + */ +proto.jspb.test.Simple2.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Simple2.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Simple2.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Simple2} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Simple2.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } +}; + + +/** + * required string a_string = 1; + * @return {string} + */ +proto.jspb.test.Simple2.prototype.getAString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.setAString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.clearAString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Simple2.prototype.hasAString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * repeated string a_repeated_string = 2; + * @return {!Array} + */ +proto.jspb.test.Simple2.prototype.getARepeatedStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.setARepeatedStringList = function(value) { + return jspb.Message.setField(this, 2, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.addARepeatedString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Simple2} returns this + */ +proto.jspb.test.Simple2.prototype.clearARepeatedStringList = function() { + return this.setARepeatedStringList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.SpecialCases.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.SpecialCases.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.SpecialCases} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.SpecialCases.toObject = function(includeInstance, msg) { + var f, obj = { +normal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +pb_default: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, +pb_function: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, +pb_var: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.SpecialCases} + */ +proto.jspb.test.SpecialCases.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.SpecialCases; + return proto.jspb.test.SpecialCases.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.SpecialCases} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.SpecialCases} + */ +proto.jspb.test.SpecialCases.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setNormal(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDefault(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setFunction(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setVar(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.SpecialCases.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.SpecialCases.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.SpecialCases} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.SpecialCases.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeString( + 4, + f + ); + } +}; + + +/** + * required string normal = 1; + * @return {string} + */ +proto.jspb.test.SpecialCases.prototype.getNormal = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.setNormal = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.clearNormal = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.SpecialCases.prototype.hasNormal = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required string default = 2; + * @return {string} + */ +proto.jspb.test.SpecialCases.prototype.getDefault = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.setDefault = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.clearDefault = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.SpecialCases.prototype.hasDefault = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * required string function = 3; + * @return {string} + */ +proto.jspb.test.SpecialCases.prototype.getFunction = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.setFunction = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.clearFunction = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.SpecialCases.prototype.hasFunction = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * required string var = 4; + * @return {string} + */ +proto.jspb.test.SpecialCases.prototype.getVar = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.setVar = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ +proto.jspb.test.SpecialCases.prototype.clearVar = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.SpecialCases.prototype.hasVar = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.OptionalFields.repeatedFields_ = [4,5]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.OptionalFields.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.OptionalFields.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OptionalFields} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OptionalFields.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +aBool: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, +aNestedMessage: (f = msg.getANestedMessage()) && proto.jspb.test.OptionalFields.Nested.toObject(includeInstance, f), +aRepeatedMessageList: jspb.Message.toObjectList(msg.getARepeatedMessageList(), + proto.jspb.test.OptionalFields.Nested.toObject, includeInstance), +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OptionalFields} + */ +proto.jspb.test.OptionalFields.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.OptionalFields; + return proto.jspb.test.OptionalFields.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OptionalFields} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OptionalFields} + */ +proto.jspb.test.OptionalFields.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setABool(value); + break; + case 3: + var value = new proto.jspb.test.OptionalFields.Nested; + reader.readMessage(value,proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader); + msg.setANestedMessage(value); + break; + case 4: + var value = new proto.jspb.test.OptionalFields.Nested; + reader.readMessage(value,proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader); + msg.addARepeatedMessage(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.OptionalFields.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.OptionalFields.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OptionalFields} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OptionalFields.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = message.getANestedMessage(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedMessageList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 5, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.OptionalFields.Nested.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.OptionalFields.Nested.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OptionalFields.Nested} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OptionalFields.Nested.toObject = function(includeInstance, msg) { + var f, obj = { +anInt: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OptionalFields.Nested} + */ +proto.jspb.test.OptionalFields.Nested.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.OptionalFields.Nested; + return proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OptionalFields.Nested} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OptionalFields.Nested} + */ +proto.jspb.test.OptionalFields.Nested.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAnInt(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.OptionalFields.Nested.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OptionalFields.Nested} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OptionalFields.Nested.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 an_int = 1; + * @return {number} + */ +proto.jspb.test.OptionalFields.Nested.prototype.getAnInt = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.OptionalFields.Nested} returns this + */ +proto.jspb.test.OptionalFields.Nested.prototype.setAnInt = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OptionalFields.Nested} returns this + */ +proto.jspb.test.OptionalFields.Nested.prototype.clearAnInt = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OptionalFields.Nested.prototype.hasAnInt = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string a_string = 1; + * @return {string} + */ +proto.jspb.test.OptionalFields.prototype.getAString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.setAString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearAString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OptionalFields.prototype.hasAString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required bool a_bool = 2; + * @return {boolean} + */ +proto.jspb.test.OptionalFields.prototype.getABool = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.setABool = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearABool = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OptionalFields.prototype.hasABool = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional Nested a_nested_message = 3; + * @return {?proto.jspb.test.OptionalFields.Nested} + */ +proto.jspb.test.OptionalFields.prototype.getANestedMessage = function() { + return /** @type{?proto.jspb.test.OptionalFields.Nested} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.OptionalFields.Nested, 3)); +}; + + +/** + * @param {?proto.jspb.test.OptionalFields.Nested|undefined} value + * @return {!proto.jspb.test.OptionalFields} returns this +*/ +proto.jspb.test.OptionalFields.prototype.setANestedMessage = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearANestedMessage = function() { + return this.setANestedMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OptionalFields.prototype.hasANestedMessage = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated Nested a_repeated_message = 4; + * @return {!Array} + */ +proto.jspb.test.OptionalFields.prototype.getARepeatedMessageList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.OptionalFields.Nested, 4)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.OptionalFields} returns this +*/ +proto.jspb.test.OptionalFields.prototype.setARepeatedMessageList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); +}; + + +/** + * @param {!proto.jspb.test.OptionalFields.Nested=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.OptionalFields.Nested} + */ +proto.jspb.test.OptionalFields.prototype.addARepeatedMessage = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, proto.jspb.test.OptionalFields.Nested, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearARepeatedMessageList = function() { + return this.setARepeatedMessageList([]); +}; + + +/** + * repeated string a_repeated_string = 5; + * @return {!Array} + */ +proto.jspb.test.OptionalFields.prototype.getARepeatedStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.setARepeatedStringList = function(value) { + return jspb.Message.setField(this, 5, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.addARepeatedString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 5, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.OptionalFields} returns this + */ +proto.jspb.test.OptionalFields.prototype.clearARepeatedStringList = function() { + return this.setARepeatedStringList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.HasExtensions.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.HasExtensions.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.HasExtensions} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.HasExtensions.toObject = function(includeInstance, msg) { + var f, obj = { +str1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +str2: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, +str3: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.HasExtensions.extensions, proto.jspb.test.HasExtensions.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.HasExtensions} + */ +proto.jspb.test.HasExtensions.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.HasExtensions; + return proto.jspb.test.HasExtensions.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.HasExtensions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.HasExtensions} + */ +proto.jspb.test.HasExtensions.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStr1(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setStr2(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setStr3(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.HasExtensions.extensionsBinary, + proto.jspb.test.HasExtensions.prototype.getExtension, + proto.jspb.test.HasExtensions.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.HasExtensions.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.HasExtensions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.HasExtensions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.HasExtensions.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.HasExtensions.extensionsBinary, proto.jspb.test.HasExtensions.prototype.getExtension); +}; + + +/** + * optional string str1 = 1; + * @return {string} + */ +proto.jspb.test.HasExtensions.prototype.getStr1 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.setStr1 = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.clearStr1 = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.HasExtensions.prototype.hasStr1 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional string str2 = 2; + * @return {string} + */ +proto.jspb.test.HasExtensions.prototype.getStr2 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.setStr2 = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.clearStr2 = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.HasExtensions.prototype.hasStr2 = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional string str3 = 3; + * @return {string} + */ +proto.jspb.test.HasExtensions.prototype.getStr3 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.setStr3 = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.HasExtensions} returns this + */ +proto.jspb.test.HasExtensions.prototype.clearStr3 = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.HasExtensions.prototype.hasStr3 = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.Complex.repeatedFields_ = [5,7]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Complex.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Complex.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Complex} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Complex.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +anOutOfOrderBool: (f = jspb.Message.getBooleanField(msg, 9)) == null ? undefined : f, +aNestedMessage: (f = msg.getANestedMessage()) && proto.jspb.test.Complex.Nested.toObject(includeInstance, f), +aRepeatedMessageList: jspb.Message.toObjectList(msg.getARepeatedMessageList(), + proto.jspb.test.Complex.Nested.toObject, includeInstance), +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 7)) == null ? undefined : f, +aFloatingPointField: (f = jspb.Message.getOptionalFloatingPointField(msg, 10)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Complex} + */ +proto.jspb.test.Complex.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Complex; + return proto.jspb.test.Complex.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Complex} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Complex} + */ +proto.jspb.test.Complex.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 9: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAnOutOfOrderBool(value); + break; + case 4: + var value = new proto.jspb.test.Complex.Nested; + reader.readMessage(value,proto.jspb.test.Complex.Nested.deserializeBinaryFromReader); + msg.setANestedMessage(value); + break; + case 5: + var value = new proto.jspb.test.Complex.Nested; + reader.readMessage(value,proto.jspb.test.Complex.Nested.deserializeBinaryFromReader); + msg.addARepeatedMessage(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + case 10: + var value = /** @type {number} */ (reader.readDouble()); + msg.setAFloatingPointField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Complex.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Complex.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Complex} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Complex.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 9)); + if (f != null) { + writer.writeBool( + 9, + f + ); + } + f = message.getANestedMessage(); + if (f != null) { + writer.writeMessage( + 4, + f, + proto.jspb.test.Complex.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedMessageList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + proto.jspb.test.Complex.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 7, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeDouble( + 10, + f + ); + } +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Complex.Nested.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Complex.Nested.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Complex.Nested} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Complex.Nested.toObject = function(includeInstance, msg) { + var f, obj = { +anInt: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Complex.Nested} + */ +proto.jspb.test.Complex.Nested.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Complex.Nested; + return proto.jspb.test.Complex.Nested.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Complex.Nested} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Complex.Nested} + */ +proto.jspb.test.Complex.Nested.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAnInt(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Complex.Nested.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Complex.Nested.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Complex.Nested} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Complex.Nested.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeInt32( + 2, + f + ); + } +}; + + +/** + * required int32 an_int = 2; + * @return {number} + */ +proto.jspb.test.Complex.Nested.prototype.getAnInt = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Complex.Nested} returns this + */ +proto.jspb.test.Complex.Nested.prototype.setAnInt = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex.Nested} returns this + */ +proto.jspb.test.Complex.Nested.prototype.clearAnInt = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.Nested.prototype.hasAnInt = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * required string a_string = 1; + * @return {string} + */ +proto.jspb.test.Complex.prototype.getAString = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.setAString = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearAString = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.hasAString = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bool an_out_of_order_bool = 9; + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.getAnOutOfOrderBool = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.setAnOutOfOrderBool = function(value) { + return jspb.Message.setField(this, 9, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearAnOutOfOrderBool = function() { + return jspb.Message.setField(this, 9, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.hasAnOutOfOrderBool = function() { + return jspb.Message.getField(this, 9) != null; +}; + + +/** + * optional Nested a_nested_message = 4; + * @return {?proto.jspb.test.Complex.Nested} + */ +proto.jspb.test.Complex.prototype.getANestedMessage = function() { + return /** @type{?proto.jspb.test.Complex.Nested} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Complex.Nested, 4)); +}; + + +/** + * @param {?proto.jspb.test.Complex.Nested|undefined} value + * @return {!proto.jspb.test.Complex} returns this +*/ +proto.jspb.test.Complex.prototype.setANestedMessage = function(value) { + return jspb.Message.setWrapperField(this, 4, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearANestedMessage = function() { + return this.setANestedMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.hasANestedMessage = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * repeated Nested a_repeated_message = 5; + * @return {!Array} + */ +proto.jspb.test.Complex.prototype.getARepeatedMessageList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.Complex.Nested, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.Complex} returns this +*/ +proto.jspb.test.Complex.prototype.setARepeatedMessageList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 5, value); +}; + + +/** + * @param {!proto.jspb.test.Complex.Nested=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.Complex.Nested} + */ +proto.jspb.test.Complex.prototype.addARepeatedMessage = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.jspb.test.Complex.Nested, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearARepeatedMessageList = function() { + return this.setARepeatedMessageList([]); +}; + + +/** + * repeated string a_repeated_string = 7; + * @return {!Array} + */ +proto.jspb.test.Complex.prototype.getARepeatedStringList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 7)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.setARepeatedStringList = function(value) { + return jspb.Message.setField(this, 7, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.addARepeatedString = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 7, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearARepeatedStringList = function() { + return this.setARepeatedStringList([]); +}; + + +/** + * optional double a_floating_point_field = 10; + * @return {number} + */ +proto.jspb.test.Complex.prototype.getAFloatingPointField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 10, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.setAFloatingPointField = function(value) { + return jspb.Message.setField(this, 10, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ +proto.jspb.test.Complex.prototype.clearAFloatingPointField = function() { + return jspb.Message.setField(this, 10, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Complex.prototype.hasAFloatingPointField = function() { + return jspb.Message.getField(this, 10) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.OuterMessage.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.OuterMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OuterMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OuterMessage.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OuterMessage} + */ +proto.jspb.test.OuterMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.OuterMessage; + return proto.jspb.test.OuterMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OuterMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OuterMessage} + */ +proto.jspb.test.OuterMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.OuterMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.OuterMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OuterMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OuterMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.OuterMessage.Complex.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.OuterMessage.Complex.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OuterMessage.Complex} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OuterMessage.Complex.toObject = function(includeInstance, msg) { + var f, obj = { +innerComplexField: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OuterMessage.Complex} + */ +proto.jspb.test.OuterMessage.Complex.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.OuterMessage.Complex; + return proto.jspb.test.OuterMessage.Complex.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OuterMessage.Complex} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OuterMessage.Complex} + */ +proto.jspb.test.OuterMessage.Complex.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setInnerComplexField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.OuterMessage.Complex.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.OuterMessage.Complex.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OuterMessage.Complex} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.OuterMessage.Complex.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 inner_complex_field = 1; + * @return {number} + */ +proto.jspb.test.OuterMessage.Complex.prototype.getInnerComplexField = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.OuterMessage.Complex} returns this + */ +proto.jspb.test.OuterMessage.Complex.prototype.setInnerComplexField = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OuterMessage.Complex} returns this + */ +proto.jspb.test.OuterMessage.Complex.prototype.clearInnerComplexField = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.OuterMessage.Complex.prototype.hasInnerComplexField = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.MineField.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.MineField.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.MineField} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.MineField.toObject = function(includeInstance, msg) { + var f, obj = { +cookie: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.MineField} + */ +proto.jspb.test.MineField.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.MineField; + return proto.jspb.test.MineField.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.MineField} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.MineField} + */ +proto.jspb.test.MineField.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setCookie(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.MineField.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.MineField.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.MineField} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.MineField.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string cookie = 1; + * @return {string} + */ +proto.jspb.test.MineField.prototype.getCookie = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.MineField} returns this + */ +proto.jspb.test.MineField.prototype.setCookie = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.MineField} returns this + */ +proto.jspb.test.MineField.prototype.clearCookie = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.MineField.prototype.hasCookie = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.IsExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.IsExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.IsExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.IsExtension.toObject = function(includeInstance, msg) { + var f, obj = { +ext1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.IsExtension} + */ +proto.jspb.test.IsExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.IsExtension; + return proto.jspb.test.IsExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.IsExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.IsExtension} + */ +proto.jspb.test.IsExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setExt1(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.IsExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.IsExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.IsExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.IsExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IsExtension.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + proto.jspb.test.IsExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.IsExtension.toObject), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IsExtension.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.IsExtension.serializeBinaryToWriter, + proto.jspb.test.IsExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[100] = proto.jspb.test.IsExtension.extField; + +/** + * optional string ext1 = 1; + * @return {string} + */ +proto.jspb.test.IsExtension.prototype.getExt1 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.IsExtension} returns this + */ +proto.jspb.test.IsExtension.prototype.setExt1 = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.IsExtension} returns this + */ +proto.jspb.test.IsExtension.prototype.clearExt1 = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.IsExtension.prototype.hasExt1 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.IndirectExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.IndirectExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.IndirectExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.IndirectExtension.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.IndirectExtension} + */ +proto.jspb.test.IndirectExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.IndirectExtension; + return proto.jspb.test.IndirectExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.IndirectExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.IndirectExtension} + */ +proto.jspb.test.IndirectExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.IndirectExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.IndirectExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.IndirectExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.IndirectExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `simple`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IndirectExtension.simple = new jspb.ExtensionFieldInfo( + 101, + {simple: 0}, + proto.jspb.test.Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.Simple1.toObject), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.simple, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.Simple1.serializeBinaryToWriter, + proto.jspb.test.Simple1.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[101] = proto.jspb.test.IndirectExtension.simple; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `str`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.IndirectExtension.str = new jspb.ExtensionFieldInfo( + 102, + {str: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.str, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[102] = proto.jspb.test.IndirectExtension.str; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `repeatedStrList`. + * @type {!jspb.ExtensionFieldInfo>} + */ +proto.jspb.test.IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( + 103, + {repeatedStrList: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 1); + +proto.jspb.test.HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.repeatedStrList, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeRepeatedString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[103] = proto.jspb.test.IndirectExtension.repeatedStrList; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `repeatedSimpleList`. + * @type {!jspb.ExtensionFieldInfo>} + */ +proto.jspb.test.IndirectExtension.repeatedSimpleList = new jspb.ExtensionFieldInfo( + 104, + {repeatedSimpleList: 0}, + proto.jspb.test.Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.Simple1.toObject), + 1); + +proto.jspb.test.HasExtensions.extensionsBinary[104] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.IndirectExtension.repeatedSimpleList, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeRepeatedMessage, + proto.jspb.test.Simple1.serializeBinaryToWriter, + proto.jspb.test.Simple1.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[104] = proto.jspb.test.IndirectExtension.repeatedSimpleList; + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.DefaultValues.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.DefaultValues.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.DefaultValues} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.DefaultValues.toObject = function(includeInstance, msg) { + var f, obj = { +stringField: jspb.Message.getFieldWithDefault(msg, 1, "default\x3c\x3e\x27\x22abc"), +boolField: jspb.Message.getBooleanFieldWithDefault(msg, 2, true), +intField: jspb.Message.getFieldWithDefault(msg, 3, 11), +enumField: jspb.Message.getFieldWithDefault(msg, 4, 13), +emptyField: jspb.Message.getFieldWithDefault(msg, 6, ""), +bytesField: msg.getBytesField_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.DefaultValues} + */ +proto.jspb.test.DefaultValues.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.DefaultValues; + return proto.jspb.test.DefaultValues.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.DefaultValues} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.DefaultValues} + */ +proto.jspb.test.DefaultValues.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStringField(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setBoolField(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setIntField(value); + break; + case 4: + var value = /** @type {!proto.jspb.test.DefaultValues.Enum} */ (reader.readEnum()); + msg.setEnumField(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setEmptyField(value); + break; + case 8: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBytesField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.DefaultValues.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.DefaultValues.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.DefaultValues} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.DefaultValues.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeInt64( + 3, + f + ); + } + f = /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeEnum( + 4, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeString( + 6, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeBytes( + 8, + f + ); + } +}; + + +/** + * @enum {number} + */ +proto.jspb.test.DefaultValues.Enum = { + E1: 13, + E2: 77 +}; + +/** + * optional string string_field = 1; + * @return {string} + */ +proto.jspb.test.DefaultValues.prototype.getStringField = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "default\x3c\x3e\x27\x22abc")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setStringField = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearStringField = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasStringField = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bool bool_field = 2; + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.getBoolField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, true)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setBoolField = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearBoolField = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasBoolField = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional int64 int_field = 3; + * @return {number} + */ +proto.jspb.test.DefaultValues.prototype.getIntField = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 11)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setIntField = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearIntField = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasIntField = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional Enum enum_field = 4; + * @return {!proto.jspb.test.DefaultValues.Enum} + */ +proto.jspb.test.DefaultValues.prototype.getEnumField = function() { + return /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getFieldWithDefault(this, 4, 13)); +}; + + +/** + * @param {!proto.jspb.test.DefaultValues.Enum} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setEnumField = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearEnumField = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasEnumField = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional string empty_field = 6; + * @return {string} + */ +proto.jspb.test.DefaultValues.prototype.getEmptyField = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setEmptyField = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearEmptyField = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasEmptyField = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional bytes bytes_field = 8; + * @return {!(string|Uint8Array)} + */ +proto.jspb.test.DefaultValues.prototype.getBytesField = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 8, "bW9v")); +}; + + +/** + * optional bytes bytes_field = 8; + * This is a type-conversion wrapper around `getBytesField()` + * @return {string} + */ +proto.jspb.test.DefaultValues.prototype.getBytesField_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBytesField())); +}; + + +/** + * optional bytes bytes_field = 8; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBytesField()` + * @return {!Uint8Array} + */ +proto.jspb.test.DefaultValues.prototype.getBytesField_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBytesField())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.setBytesField = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ +proto.jspb.test.DefaultValues.prototype.clearBytesField = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.DefaultValues.prototype.hasBytesField = function() { + return jspb.Message.getField(this, 8) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.FloatingPointFields.repeatedFields_ = [3,7]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.FloatingPointFields.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.FloatingPointFields.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.FloatingPointFields} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.FloatingPointFields.toObject = function(includeInstance, msg) { + var f, obj = { +optionalFloatField: (f = jspb.Message.getOptionalFloatingPointField(msg, 1)) == null ? undefined : f, +requiredFloatField: (f = jspb.Message.getOptionalFloatingPointField(msg, 2)) == null ? undefined : f, +repeatedFloatFieldList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 3)) == null ? undefined : f, +defaultFloatField: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 2.0), +optionalDoubleField: (f = jspb.Message.getOptionalFloatingPointField(msg, 5)) == null ? undefined : f, +requiredDoubleField: (f = jspb.Message.getOptionalFloatingPointField(msg, 6)) == null ? undefined : f, +repeatedDoubleFieldList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 7)) == null ? undefined : f, +defaultDoubleField: jspb.Message.getFloatingPointFieldWithDefault(msg, 8, 2.0) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.FloatingPointFields} + */ +proto.jspb.test.FloatingPointFields.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.FloatingPointFields; + return proto.jspb.test.FloatingPointFields.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.FloatingPointFields} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.FloatingPointFields} + */ +proto.jspb.test.FloatingPointFields.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readFloat()); + msg.setOptionalFloatField(value); + break; + case 2: + var value = /** @type {number} */ (reader.readFloat()); + msg.setRequiredFloatField(value); + break; + case 3: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readFloat() : [reader.readFloat()]); + for (var i = 0; i < values.length; i++) { + msg.addRepeatedFloatField(values[i]); + } + break; + case 4: + var value = /** @type {number} */ (reader.readFloat()); + msg.setDefaultFloatField(value); + break; + case 5: + var value = /** @type {number} */ (reader.readDouble()); + msg.setOptionalDoubleField(value); + break; + case 6: + var value = /** @type {number} */ (reader.readDouble()); + msg.setRequiredDoubleField(value); + break; + case 7: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readDouble() : [reader.readDouble()]); + for (var i = 0; i < values.length; i++) { + msg.addRepeatedDoubleField(values[i]); + } + break; + case 8: + var value = /** @type {number} */ (reader.readDouble()); + msg.setDefaultDoubleField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.FloatingPointFields.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.FloatingPointFields.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.FloatingPointFields} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.FloatingPointFields.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeFloat( + 1, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeFloat( + 2, + f + ); + } + f = message.getRepeatedFloatFieldList(); + if (f.length > 0) { + writer.writeRepeatedFloat( + 3, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeFloat( + 4, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeDouble( + 5, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeDouble( + 6, + f + ); + } + f = message.getRepeatedDoubleFieldList(); + if (f.length > 0) { + writer.writeRepeatedDouble( + 7, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeDouble( + 8, + f + ); + } +}; + + +/** + * optional float optional_float_field = 1; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getOptionalFloatField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setOptionalFloatField = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearOptionalFloatField = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasOptionalFloatField = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required float required_float_field = 2; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getRequiredFloatField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setRequiredFloatField = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearRequiredFloatField = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasRequiredFloatField = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * repeated float repeated_float_field = 3; + * @return {!Array} + */ +proto.jspb.test.FloatingPointFields.prototype.getRepeatedFloatFieldList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setRepeatedFloatFieldList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.addRepeatedFloatField = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearRepeatedFloatFieldList = function() { + return this.setRepeatedFloatFieldList([]); +}; + + +/** + * optional float default_float_field = 4; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getDefaultFloatField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 2.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setDefaultFloatField = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearDefaultFloatField = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasDefaultFloatField = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * optional double optional_double_field = 5; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getOptionalDoubleField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setOptionalDoubleField = function(value) { + return jspb.Message.setField(this, 5, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearOptionalDoubleField = function() { + return jspb.Message.setField(this, 5, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasOptionalDoubleField = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * required double required_double_field = 6; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getRequiredDoubleField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 6, 0.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setRequiredDoubleField = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearRequiredDoubleField = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasRequiredDoubleField = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * repeated double repeated_double_field = 7; + * @return {!Array} + */ +proto.jspb.test.FloatingPointFields.prototype.getRepeatedDoubleFieldList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 7)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setRepeatedDoubleFieldList = function(value) { + return jspb.Message.setField(this, 7, value || []); +}; + + +/** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.addRepeatedDoubleField = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 7, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearRepeatedDoubleFieldList = function() { + return this.setRepeatedDoubleFieldList([]); +}; + + +/** + * optional double default_double_field = 8; + * @return {number} + */ +proto.jspb.test.FloatingPointFields.prototype.getDefaultDoubleField = function() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 8, 2.0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.setDefaultDoubleField = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ +proto.jspb.test.FloatingPointFields.prototype.clearDefaultDoubleField = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.FloatingPointFields.prototype.hasDefaultDoubleField = function() { + return jspb.Message.getField(this, 8) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.BooleanFields.repeatedFields_ = [3]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.BooleanFields.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.BooleanFields.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.BooleanFields} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.BooleanFields.toObject = function(includeInstance, msg) { + var f, obj = { +optionalBooleanField: (f = jspb.Message.getBooleanField(msg, 1)) == null ? undefined : f, +requiredBooleanField: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, +repeatedBooleanFieldList: (f = jspb.Message.getRepeatedBooleanField(msg, 3)) == null ? undefined : f, +defaultBooleanField: jspb.Message.getBooleanFieldWithDefault(msg, 4, true) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.BooleanFields} + */ +proto.jspb.test.BooleanFields.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.BooleanFields; + return proto.jspb.test.BooleanFields.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.BooleanFields} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.BooleanFields} + */ +proto.jspb.test.BooleanFields.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOptionalBooleanField(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setRequiredBooleanField(value); + break; + case 3: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readBool() : [reader.readBool()]); + for (var i = 0; i < values.length; i++) { + msg.addRepeatedBooleanField(values[i]); + } + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDefaultBooleanField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.BooleanFields.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.BooleanFields.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.BooleanFields} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.BooleanFields.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {boolean} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeBool( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = message.getRepeatedBooleanFieldList(); + if (f.length > 0) { + writer.writeRepeatedBool( + 3, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeBool( + 4, + f + ); + } +}; + + +/** + * optional bool optional_boolean_field = 1; + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.getOptionalBooleanField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.setOptionalBooleanField = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.clearOptionalBooleanField = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.hasOptionalBooleanField = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * required bool required_boolean_field = 2; + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.getRequiredBooleanField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.setRequiredBooleanField = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.clearRequiredBooleanField = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.hasRequiredBooleanField = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * repeated bool repeated_boolean_field = 3; + * @return {!Array} + */ +proto.jspb.test.BooleanFields.prototype.getRepeatedBooleanFieldList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 3)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.setRepeatedBooleanFieldList = function(value) { + return jspb.Message.setField(this, 3, value || []); +}; + + +/** + * @param {boolean} value + * @param {number=} opt_index + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.addRepeatedBooleanField = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.clearRepeatedBooleanFieldList = function() { + return this.setRepeatedBooleanFieldList([]); +}; + + +/** + * optional bool default_boolean_field = 4; + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.getDefaultBooleanField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, true)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.setDefaultBooleanField = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.BooleanFields} returns this + */ +proto.jspb.test.BooleanFields.prototype.clearDefaultBooleanField = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.BooleanFields.prototype.hasDefaultBooleanField = function() { + return jspb.Message.getField(this, 4) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.TestClone.repeatedFields_ = [5]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestClone.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestClone.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestClone} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestClone.toObject = function(includeInstance, msg) { + var f, obj = { +str: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +simple1: (f = msg.getSimple1()) && proto.jspb.test.Simple1.toObject(includeInstance, f), +simple2List: jspb.Message.toObjectList(msg.getSimple2List(), + proto.jspb.test.Simple1.toObject, includeInstance), +bytesField: msg.getBytesField_asB64(), +unused: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.TestClone.extensions, proto.jspb.test.TestClone.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestClone} + */ +proto.jspb.test.TestClone.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestClone; + return proto.jspb.test.TestClone.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestClone} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestClone} + */ +proto.jspb.test.TestClone.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStr(value); + break; + case 3: + var value = new proto.jspb.test.Simple1; + reader.readMessage(value,proto.jspb.test.Simple1.deserializeBinaryFromReader); + msg.setSimple1(value); + break; + case 5: + var value = new proto.jspb.test.Simple1; + reader.readMessage(value,proto.jspb.test.Simple1.deserializeBinaryFromReader); + msg.addSimple2(value); + break; + case 6: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBytesField(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setUnused(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.TestClone.extensionsBinary, + proto.jspb.test.TestClone.prototype.getExtension, + proto.jspb.test.TestClone.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestClone.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestClone.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestClone} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestClone.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getSimple1(); + if (f != null) { + writer.writeMessage( + 3, + f, + proto.jspb.test.Simple1.serializeBinaryToWriter + ); + } + f = message.getSimple2List(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + proto.jspb.test.Simple1.serializeBinaryToWriter + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeBytes( + 6, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeString( + 7, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.TestClone.extensionsBinary, proto.jspb.test.TestClone.prototype.getExtension); +}; + + +/** + * optional string str = 1; + * @return {string} + */ +proto.jspb.test.TestClone.prototype.getStr = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.setStr = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearStr = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestClone.prototype.hasStr = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional Simple1 simple1 = 3; + * @return {?proto.jspb.test.Simple1} + */ +proto.jspb.test.TestClone.prototype.getSimple1 = function() { + return /** @type{?proto.jspb.test.Simple1} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Simple1, 3)); +}; + + +/** + * @param {?proto.jspb.test.Simple1|undefined} value + * @return {!proto.jspb.test.TestClone} returns this +*/ +proto.jspb.test.TestClone.prototype.setSimple1 = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearSimple1 = function() { + return this.setSimple1(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestClone.prototype.hasSimple1 = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * repeated Simple1 simple2 = 5; + * @return {!Array} + */ +proto.jspb.test.TestClone.prototype.getSimple2List = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.Simple1, 5)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.TestClone} returns this +*/ +proto.jspb.test.TestClone.prototype.setSimple2List = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 5, value); +}; + + +/** + * @param {!proto.jspb.test.Simple1=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.Simple1} + */ +proto.jspb.test.TestClone.prototype.addSimple2 = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, proto.jspb.test.Simple1, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearSimple2List = function() { + return this.setSimple2List([]); +}; + + +/** + * optional bytes bytes_field = 6; + * @return {!(string|Uint8Array)} + */ +proto.jspb.test.TestClone.prototype.getBytesField = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * optional bytes bytes_field = 6; + * This is a type-conversion wrapper around `getBytesField()` + * @return {string} + */ +proto.jspb.test.TestClone.prototype.getBytesField_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBytesField())); +}; + + +/** + * optional bytes bytes_field = 6; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBytesField()` + * @return {!Uint8Array} + */ +proto.jspb.test.TestClone.prototype.getBytesField_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBytesField())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.setBytesField = function(value) { + return jspb.Message.setField(this, 6, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearBytesField = function() { + return jspb.Message.setField(this, 6, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestClone.prototype.hasBytesField = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional string unused = 7; + * @return {string} + */ +proto.jspb.test.TestClone.prototype.getUnused = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.setUnused = function(value) { + return jspb.Message.setField(this, 7, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ +proto.jspb.test.TestClone.prototype.clearUnused = function() { + return jspb.Message.setField(this, 7, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestClone.prototype.hasUnused = function() { + return jspb.Message.getField(this, 7) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestCloneExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestCloneExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestCloneExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestCloneExtension.toObject = function(includeInstance, msg) { + var f, obj = { +f: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestCloneExtension} + */ +proto.jspb.test.TestCloneExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestCloneExtension; + return proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestCloneExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestCloneExtension} + */ +proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setF(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestCloneExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestCloneExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestCloneExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestCloneExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `lowExt`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.TestCloneExtension.lowExt = new jspb.ExtensionFieldInfo( + 11, + {lowExt: 0}, + proto.jspb.test.TestCloneExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.TestCloneExtension.toObject), + 0); + +proto.jspb.test.TestClone.extensionsBinary[11] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.TestCloneExtension.lowExt, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.TestCloneExtension.serializeBinaryToWriter, + proto.jspb.test.TestCloneExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestClone.extensions[11] = proto.jspb.test.TestCloneExtension.lowExt; + +/** + * optional int32 f = 1; + * @return {number} + */ +proto.jspb.test.TestCloneExtension.prototype.getF = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestCloneExtension} returns this + */ +proto.jspb.test.TestCloneExtension.prototype.setF = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestCloneExtension} returns this + */ +proto.jspb.test.TestCloneExtension.prototype.clearF = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestCloneExtension.prototype.hasF = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.CloneExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.CloneExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.CloneExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.CloneExtension.toObject = function(includeInstance, msg) { + var f, obj = { +ext: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.CloneExtension} + */ +proto.jspb.test.CloneExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.CloneExtension; + return proto.jspb.test.CloneExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.CloneExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.CloneExtension} + */ +proto.jspb.test.CloneExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setExt(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.CloneExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.CloneExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.CloneExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.CloneExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.CloneExtension.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + proto.jspb.test.CloneExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.CloneExtension.toObject), + 0); + +proto.jspb.test.TestClone.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.CloneExtension.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.CloneExtension.serializeBinaryToWriter, + proto.jspb.test.CloneExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestClone.extensions[100] = proto.jspb.test.CloneExtension.extField; + +/** + * optional string ext = 2; + * @return {string} + */ +proto.jspb.test.CloneExtension.prototype.getExt = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.CloneExtension} returns this + */ +proto.jspb.test.CloneExtension.prototype.setExt = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.CloneExtension} returns this + */ +proto.jspb.test.CloneExtension.prototype.clearExt = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.CloneExtension.prototype.hasExt = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.TestGroup.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.toObject = function(includeInstance, msg) { + var f, obj = { +repeatedGroupList: jspb.Message.toObjectList(msg.getRepeatedGroupList(), + proto.jspb.test.TestGroup.RepeatedGroup.toObject, includeInstance), +requiredGroup: (f = msg.getRequiredGroup()) && proto.jspb.test.TestGroup.RequiredGroup.toObject(includeInstance, f), +optionalGroup: (f = msg.getOptionalGroup()) && proto.jspb.test.TestGroup.OptionalGroup.toObject(includeInstance, f), +id: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f, +requiredSimple: (f = msg.getRequiredSimple()) && proto.jspb.test.Simple2.toObject(includeInstance, f), +optionalSimple: (f = msg.getOptionalSimple()) && proto.jspb.test.Simple2.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup} + */ +proto.jspb.test.TestGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup; + return proto.jspb.test.TestGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup} + */ +proto.jspb.test.TestGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.jspb.test.TestGroup.RepeatedGroup; + reader.readGroup(1, value,proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader); + msg.addRepeatedGroup(value); + break; + case 2: + var value = new proto.jspb.test.TestGroup.RequiredGroup; + reader.readGroup(2, value,proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader); + msg.setRequiredGroup(value); + break; + case 3: + var value = new proto.jspb.test.TestGroup.OptionalGroup; + reader.readGroup(3, value,proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader); + msg.setOptionalGroup(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 5: + var value = new proto.jspb.test.Simple2; + reader.readMessage(value,proto.jspb.test.Simple2.deserializeBinaryFromReader); + msg.setRequiredSimple(value); + break; + case 6: + var value = new proto.jspb.test.Simple2; + reader.readMessage(value,proto.jspb.test.Simple2.deserializeBinaryFromReader); + msg.setOptionalSimple(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getRepeatedGroupList(); + if (f.length > 0) { + writer.writeRepeatedGroup( + 1, + f, + proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter + ); + } + f = message.getRequiredGroup(); + if (f != null) { + writer.writeGroup( + 2, + f, + proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter + ); + } + f = message.getOptionalGroup(); + if (f != null) { + writer.writeGroup( + 3, + f, + proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeString( + 4, + f + ); + } + f = message.getRequiredSimple(); + if (f != null) { + writer.writeMessage( + 5, + f, + proto.jspb.test.Simple2.serializeBinaryToWriter + ); + } + f = message.getOptionalSimple(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.jspb.test.Simple2.serializeBinaryToWriter + ); + } +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.TestGroup.RepeatedGroup.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup.RepeatedGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.RepeatedGroup.toObject = function(includeInstance, msg) { + var f, obj = { +id: (f = jspb.Message.getField(msg, 0)) == null ? undefined : f, +someBoolList: (f = jspb.Message.getRepeatedBooleanField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + */ +proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup.RepeatedGroup; + return proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + */ +proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 2: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readBool() : [reader.readBool()]); + for (var i = 0; i < values.length; i++) { + msg.addSomeBool(values[i]); + } + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 0)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getSomeBoolList(); + if (f.length > 0) { + writer.writeRepeatedBool( + 2, + f + ); + } +}; + + +/** + * required string id = 1; + * @return {string} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 0, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.setId = function(value) { + return jspb.Message.setField(this, 0, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.clearId = function() { + return jspb.Message.setField(this, 0, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.hasId = function() { + return jspb.Message.getField(this, 0) != null; +}; + + +/** + * repeated bool some_bool = 2; + * @return {!Array} + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.getSomeBoolList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.setSomeBoolList = function(value) { + return jspb.Message.setField(this, 1, value || []); +}; + + +/** + * @param {boolean} value + * @param {number=} opt_index + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.addSomeBool = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ +proto.jspb.test.TestGroup.RepeatedGroup.prototype.clearSomeBoolList = function() { + return this.setSomeBoolList([]); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup.RequiredGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup.RequiredGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.RequiredGroup.toObject = function(includeInstance, msg) { + var f, obj = { +id: (f = jspb.Message.getField(msg, -1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup.RequiredGroup} + */ +proto.jspb.test.TestGroup.RequiredGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup.RequiredGroup; + return proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup.RequiredGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup.RequiredGroup} + */ +proto.jspb.test.TestGroup.RequiredGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup.RequiredGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.RequiredGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, -1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * required string id = 1; + * @return {string} + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, -1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.setId = function(value) { + return jspb.Message.setField(this, -1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.clearId = function() { + return jspb.Message.setField(this, -1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.RequiredGroup.prototype.hasId = function() { + return jspb.Message.getField(this, -1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup.OptionalGroup.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup.OptionalGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.OptionalGroup.toObject = function(includeInstance, msg) { + var f, obj = { +id: (f = jspb.Message.getField(msg, -2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup.OptionalGroup} + */ +proto.jspb.test.TestGroup.OptionalGroup.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup.OptionalGroup; + return proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup.OptionalGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup.OptionalGroup} + */ +proto.jspb.test.TestGroup.OptionalGroup.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup.OptionalGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup.OptionalGroup.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, -2)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * required string id = 1; + * @return {string} + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, -2, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.setId = function(value) { + return jspb.Message.setField(this, -2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.clearId = function() { + return jspb.Message.setField(this, -2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.OptionalGroup.prototype.hasId = function() { + return jspb.Message.getField(this, -2) != null; +}; + + +/** + * repeated group RepeatedGroup = 1; + * @return {!Array} + */ +proto.jspb.test.TestGroup.prototype.getRepeatedGroupList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.jspb.test.TestGroup.RepeatedGroup, 1)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setRepeatedGroupList = function(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.jspb.test.TestGroup.RepeatedGroup=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + */ +proto.jspb.test.TestGroup.prototype.addRepeatedGroup = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.jspb.test.TestGroup.RepeatedGroup, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearRepeatedGroupList = function() { + return this.setRepeatedGroupList([]); +}; + + +/** + * required group RequiredGroup = 2; + * @return {!proto.jspb.test.TestGroup.RequiredGroup} + */ +proto.jspb.test.TestGroup.prototype.getRequiredGroup = function() { + return /** @type{!proto.jspb.test.TestGroup.RequiredGroup} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestGroup.RequiredGroup, 2, 1)); +}; + + +/** + * @param {!proto.jspb.test.TestGroup.RequiredGroup} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setRequiredGroup = function(value) { + return jspb.Message.setWrapperField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearRequiredGroup = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasRequiredGroup = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional group OptionalGroup = 3; + * @return {?proto.jspb.test.TestGroup.OptionalGroup} + */ +proto.jspb.test.TestGroup.prototype.getOptionalGroup = function() { + return /** @type{?proto.jspb.test.TestGroup.OptionalGroup} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestGroup.OptionalGroup, 3)); +}; + + +/** + * @param {?proto.jspb.test.TestGroup.OptionalGroup|undefined} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setOptionalGroup = function(value) { + return jspb.Message.setWrapperField(this, 3, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearOptionalGroup = function() { + return this.setOptionalGroup(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasOptionalGroup = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional string id = 4; + * @return {string} + */ +proto.jspb.test.TestGroup.prototype.getId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.setId = function(value) { + return jspb.Message.setField(this, 4, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearId = function() { + return jspb.Message.setField(this, 4, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasId = function() { + return jspb.Message.getField(this, 4) != null; +}; + + +/** + * required Simple2 required_simple = 5; + * @return {!proto.jspb.test.Simple2} + */ +proto.jspb.test.TestGroup.prototype.getRequiredSimple = function() { + return /** @type{!proto.jspb.test.Simple2} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Simple2, 5, 1)); +}; + + +/** + * @param {!proto.jspb.test.Simple2} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setRequiredSimple = function(value) { + return jspb.Message.setWrapperField(this, 5, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearRequiredSimple = function() { + return jspb.Message.setField(this, 5, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasRequiredSimple = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional Simple2 optional_simple = 6; + * @return {?proto.jspb.test.Simple2} + */ +proto.jspb.test.TestGroup.prototype.getOptionalSimple = function() { + return /** @type{?proto.jspb.test.Simple2} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Simple2, 6)); +}; + + +/** + * @param {?proto.jspb.test.Simple2|undefined} value + * @return {!proto.jspb.test.TestGroup} returns this +*/ +proto.jspb.test.TestGroup.prototype.setOptionalSimple = function(value) { + return jspb.Message.setWrapperField(this, 6, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ +proto.jspb.test.TestGroup.prototype.clearOptionalSimple = function() { + return this.setOptionalSimple(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup.prototype.hasOptionalSimple = function() { + return jspb.Message.getField(this, 6) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestGroup1.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestGroup1.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup1} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup1.toObject = function(includeInstance, msg) { + var f, obj = { +group: (f = msg.getGroup()) && proto.jspb.test.TestGroup.RepeatedGroup.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup1} + */ +proto.jspb.test.TestGroup1.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestGroup1; + return proto.jspb.test.TestGroup1.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup1} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup1} + */ +proto.jspb.test.TestGroup1.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.jspb.test.TestGroup.RepeatedGroup; + reader.readMessage(value,proto.jspb.test.TestGroup.RepeatedGroup.deserializeBinaryFromReader); + msg.setGroup(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestGroup1.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestGroup1.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup1} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestGroup1.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getGroup(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.jspb.test.TestGroup.RepeatedGroup.serializeBinaryToWriter + ); + } +}; + + +/** + * optional TestGroup.RepeatedGroup group = 1; + * @return {?proto.jspb.test.TestGroup.RepeatedGroup} + */ +proto.jspb.test.TestGroup1.prototype.getGroup = function() { + return /** @type{?proto.jspb.test.TestGroup.RepeatedGroup} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestGroup.RepeatedGroup, 1)); +}; + + +/** + * @param {?proto.jspb.test.TestGroup.RepeatedGroup|undefined} value + * @return {!proto.jspb.test.TestGroup1} returns this +*/ +proto.jspb.test.TestGroup1.prototype.setGroup = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestGroup1} returns this + */ +proto.jspb.test.TestGroup1.prototype.clearGroup = function() { + return this.setGroup(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestGroup1.prototype.hasGroup = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestReservedNames.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestReservedNames.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestReservedNames} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestReservedNames.toObject = function(includeInstance, msg) { + var f, obj = { +extension: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.TestReservedNames.extensions, proto.jspb.test.TestReservedNames.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestReservedNames} + */ +proto.jspb.test.TestReservedNames.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestReservedNames; + return proto.jspb.test.TestReservedNames.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestReservedNames} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestReservedNames} + */ +proto.jspb.test.TestReservedNames.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setExtension$(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.TestReservedNames.extensionsBinary, + proto.jspb.test.TestReservedNames.prototype.getExtension, + proto.jspb.test.TestReservedNames.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestReservedNames.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestReservedNames.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestReservedNames} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestReservedNames.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.TestReservedNames.extensionsBinary, proto.jspb.test.TestReservedNames.prototype.getExtension); +}; + + +/** + * optional int32 extension = 1; + * @return {number} + */ +proto.jspb.test.TestReservedNames.prototype.getExtension$ = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestReservedNames} returns this + */ +proto.jspb.test.TestReservedNames.prototype.setExtension$ = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestReservedNames} returns this + */ +proto.jspb.test.TestReservedNames.prototype.clearExtension$ = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestReservedNames.prototype.hasExtension$ = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestReservedNamesExtension.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestReservedNamesExtension.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestReservedNamesExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestReservedNamesExtension.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestReservedNamesExtension} + */ +proto.jspb.test.TestReservedNamesExtension.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestReservedNamesExtension; + return proto.jspb.test.TestReservedNamesExtension.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestReservedNamesExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestReservedNamesExtension} + */ +proto.jspb.test.TestReservedNamesExtension.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestReservedNamesExtension.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestReservedNamesExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestReservedNamesExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestReservedNamesExtension.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `foo`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( + 10, + {foo: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.TestReservedNames.extensionsBinary[10] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.TestReservedNamesExtension.foo, + jspb.BinaryReader.prototype.readInt32, + jspb.BinaryWriter.prototype.writeInt32, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestReservedNames.extensions[10] = proto.jspb.test.TestReservedNamesExtension.foo; + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.jspb.test.TestMessageWithOneof.repeatedFields_ = [9]; + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +proto.jspb.test.TestMessageWithOneof.oneofGroups_ = [[3,5],[6,7],[10,11],[12,13]]; + +/** + * @enum {number} + */ +proto.jspb.test.TestMessageWithOneof.PartialOneofCase = { + PARTIAL_ONEOF_NOT_SET: 0, + PONE: 3, + PTHREE: 5 +}; + +/** + * @return {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getPartialOneofCase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0])); +}; + +/** + * @enum {number} + */ +proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase = { + RECURSIVE_ONEOF_NOT_SET: 0, + RONE: 6, + RTWO: 7 +}; + +/** + * @return {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getRecursiveOneofCase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1])); +}; + +/** + * @enum {number} + */ +proto.jspb.test.TestMessageWithOneof.DefaultOneofACase = { + DEFAULT_ONEOF_A_NOT_SET: 0, + AONE: 10, + ATWO: 11 +}; + +/** + * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getDefaultOneofACase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2])); +}; + +/** + * @enum {number} + */ +proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase = { + DEFAULT_ONEOF_B_NOT_SET: 0, + BONE: 12, + BTWO: 13 +}; + +/** + * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getDefaultOneofBCase = function() { + return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} */(jspb.Message.computeOneofCase(this, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3])); +}; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestMessageWithOneof.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestMessageWithOneof.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestMessageWithOneof} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestMessageWithOneof.toObject = function(includeInstance, msg) { + var f, obj = { +pone: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, +pthree: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f, +rone: (f = msg.getRone()) && proto.jspb.test.TestMessageWithOneof.toObject(includeInstance, f), +rtwo: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f, +normalField: (f = jspb.Message.getBooleanField(msg, 8)) == null ? undefined : f, +repeatedFieldList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f, +aone: jspb.Message.getFieldWithDefault(msg, 10, 1234), +atwo: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f, +bone: (f = jspb.Message.getField(msg, 12)) == null ? undefined : f, +btwo: jspb.Message.getFieldWithDefault(msg, 13, 1234) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestMessageWithOneof} + */ +proto.jspb.test.TestMessageWithOneof.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestMessageWithOneof; + return proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestMessageWithOneof} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestMessageWithOneof} + */ +proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setPone(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setPthree(value); + break; + case 6: + var value = new proto.jspb.test.TestMessageWithOneof; + reader.readMessage(value,proto.jspb.test.TestMessageWithOneof.deserializeBinaryFromReader); + msg.setRone(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setRtwo(value); + break; + case 8: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setNormalField(value); + break; + case 9: + var value = /** @type {string} */ (reader.readString()); + msg.addRepeatedField(value); + break; + case 10: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAone(value); + break; + case 11: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAtwo(value); + break; + case 12: + var value = /** @type {number} */ (reader.readInt32()); + msg.setBone(value); + break; + case 13: + var value = /** @type {number} */ (reader.readInt32()); + msg.setBtwo(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestMessageWithOneof.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestMessageWithOneof} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeString( + 5, + f + ); + } + f = message.getRone(); + if (f != null) { + writer.writeMessage( + 6, + f, + proto.jspb.test.TestMessageWithOneof.serializeBinaryToWriter + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeString( + 7, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeBool( + 8, + f + ); + } + f = message.getRepeatedFieldList(); + if (f.length > 0) { + writer.writeRepeatedString( + 9, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeInt32( + 10, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 11)); + if (f != null) { + writer.writeInt32( + 11, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 12)); + if (f != null) { + writer.writeInt32( + 12, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 13)); + if (f != null) { + writer.writeInt32( + 13, + f + ); + } +}; + + +/** + * optional string pone = 3; + * @return {string} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getPone = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setPone = function(value) { + return jspb.Message.setOneofField(this, 3, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearPone = function() { + return jspb.Message.setOneofField(this, 3, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasPone = function() { + return jspb.Message.getField(this, 3) != null; +}; + + +/** + * optional string pthree = 5; + * @return {string} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getPthree = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setPthree = function(value) { + return jspb.Message.setOneofField(this, 5, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearPthree = function() { + return jspb.Message.setOneofField(this, 5, proto.jspb.test.TestMessageWithOneof.oneofGroups_[0], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasPthree = function() { + return jspb.Message.getField(this, 5) != null; +}; + + +/** + * optional TestMessageWithOneof rone = 6; + * @return {?proto.jspb.test.TestMessageWithOneof} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getRone = function() { + return /** @type{?proto.jspb.test.TestMessageWithOneof} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestMessageWithOneof, 6)); +}; + + +/** + * @param {?proto.jspb.test.TestMessageWithOneof|undefined} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this +*/ +proto.jspb.test.TestMessageWithOneof.prototype.setRone = function(value) { + return jspb.Message.setOneofWrapperField(this, 6, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1], value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearRone = function() { + return this.setRone(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasRone = function() { + return jspb.Message.getField(this, 6) != null; +}; + + +/** + * optional string rtwo = 7; + * @return {string} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getRtwo = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setRtwo = function(value) { + return jspb.Message.setOneofField(this, 7, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearRtwo = function() { + return jspb.Message.setOneofField(this, 7, proto.jspb.test.TestMessageWithOneof.oneofGroups_[1], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasRtwo = function() { + return jspb.Message.getField(this, 7) != null; +}; + + +/** + * optional bool normal_field = 8; + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getNormalField = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setNormalField = function(value) { + return jspb.Message.setField(this, 8, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearNormalField = function() { + return jspb.Message.setField(this, 8, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasNormalField = function() { + return jspb.Message.getField(this, 8) != null; +}; + + +/** + * repeated string repeated_field = 9; + * @return {!Array} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getRepeatedFieldList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 9)); +}; + + +/** + * @param {!Array} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setRepeatedFieldList = function(value) { + return jspb.Message.setField(this, 9, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.addRepeatedField = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 9, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearRepeatedFieldList = function() { + return this.setRepeatedFieldList([]); +}; + + +/** + * optional int32 aone = 10; + * @return {number} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getAone = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 10, 1234)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setAone = function(value) { + return jspb.Message.setOneofField(this, 10, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearAone = function() { + return jspb.Message.setOneofField(this, 10, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasAone = function() { + return jspb.Message.getField(this, 10) != null; +}; + + +/** + * optional int32 atwo = 11; + * @return {number} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getAtwo = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setAtwo = function(value) { + return jspb.Message.setOneofField(this, 11, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearAtwo = function() { + return jspb.Message.setOneofField(this, 11, proto.jspb.test.TestMessageWithOneof.oneofGroups_[2], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasAtwo = function() { + return jspb.Message.getField(this, 11) != null; +}; + + +/** + * optional int32 bone = 12; + * @return {number} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getBone = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 12, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setBone = function(value) { + return jspb.Message.setOneofField(this, 12, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearBone = function() { + return jspb.Message.setOneofField(this, 12, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasBone = function() { + return jspb.Message.getField(this, 12) != null; +}; + + +/** + * optional int32 btwo = 13; + * @return {number} + */ +proto.jspb.test.TestMessageWithOneof.prototype.getBtwo = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 1234)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.setBtwo = function(value) { + return jspb.Message.setOneofField(this, 13, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ +proto.jspb.test.TestMessageWithOneof.prototype.clearBtwo = function() { + return jspb.Message.setOneofField(this, 13, proto.jspb.test.TestMessageWithOneof.oneofGroups_[3], undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMessageWithOneof.prototype.hasBtwo = function() { + return jspb.Message.getField(this, 13) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestEndsWithBytes.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestEndsWithBytes.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestEndsWithBytes} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestEndsWithBytes.toObject = function(includeInstance, msg) { + var f, obj = { +value: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +data: msg.getData_asB64() + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestEndsWithBytes} + */ +proto.jspb.test.TestEndsWithBytes.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestEndsWithBytes; + return proto.jspb.test.TestEndsWithBytes.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestEndsWithBytes} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestEndsWithBytes} + */ +proto.jspb.test.TestEndsWithBytes.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setValue(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestEndsWithBytes.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestEndsWithBytes.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestEndsWithBytes} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestEndsWithBytes.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBytes( + 2, + f + ); + } +}; + + +/** + * optional int32 value = 1; + * @return {number} + */ +proto.jspb.test.TestEndsWithBytes.prototype.getValue = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ +proto.jspb.test.TestEndsWithBytes.prototype.setValue = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ +proto.jspb.test.TestEndsWithBytes.prototype.clearValue = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestEndsWithBytes.prototype.hasValue = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional bytes data = 2; + * @return {!(string|Uint8Array)} + */ +proto.jspb.test.TestEndsWithBytes.prototype.getData = function() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** + * optional bytes data = 2; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ +proto.jspb.test.TestEndsWithBytes.prototype.getData_asB64 = function() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); +}; + + +/** + * optional bytes data = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ +proto.jspb.test.TestEndsWithBytes.prototype.getData_asU8 = function() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); +}; + + +/** + * @param {!(string|Uint8Array)} value + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ +proto.jspb.test.TestEndsWithBytes.prototype.setData = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ +proto.jspb.test.TestEndsWithBytes.prototype.clearData = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestEndsWithBytes.prototype.hasData = function() { + return jspb.Message.getField(this, 2) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestLastFieldBeforePivot.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestLastFieldBeforePivot} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestLastFieldBeforePivot.toObject = function(includeInstance, msg) { + var f, obj = { +lastFieldBeforePivot: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.TestLastFieldBeforePivot.extensions, proto.jspb.test.TestLastFieldBeforePivot.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestLastFieldBeforePivot} + */ +proto.jspb.test.TestLastFieldBeforePivot.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestLastFieldBeforePivot; + return proto.jspb.test.TestLastFieldBeforePivot.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestLastFieldBeforePivot} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestLastFieldBeforePivot} + */ +proto.jspb.test.TestLastFieldBeforePivot.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setLastFieldBeforePivot(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary, + proto.jspb.test.TestLastFieldBeforePivot.prototype.getExtension, + proto.jspb.test.TestLastFieldBeforePivot.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestLastFieldBeforePivot.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestLastFieldBeforePivot} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestLastFieldBeforePivot.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary, proto.jspb.test.TestLastFieldBeforePivot.prototype.getExtension); +}; + + +/** + * optional int32 last_field_before_pivot = 1; + * @return {number} + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.getLastFieldBeforePivot = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.setLastFieldBeforePivot = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.clearLastFieldBeforePivot = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestLastFieldBeforePivot.prototype.hasLastFieldBeforePivot = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Int64Types.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Int64Types.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Int64Types} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Int64Types.toObject = function(includeInstance, msg) { + var f, obj = { +int64Normal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +int64String: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, +int64Number: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Int64Types} + */ +proto.jspb.test.Int64Types.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Int64Types; + return proto.jspb.test.Int64Types.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Int64Types} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Int64Types} + */ +proto.jspb.test.Int64Types.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setInt64Normal(value); + break; + case 2: + var value = /** @type {string} */ (reader.readSint64String()); + msg.setInt64String(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setInt64Number(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Int64Types.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Int64Types.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Int64Types} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Int64Types.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt64( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeSint64String( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeUint64( + 3, + f + ); + } +}; + + +/** + * optional int64 int64_normal = 1; + * @return {number} + */ +proto.jspb.test.Int64Types.prototype.getInt64Normal = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.setInt64Normal = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.clearInt64Normal = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Int64Types.prototype.hasInt64Normal = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * optional sint64 int64_string = 2; + * @return {string} + */ +proto.jspb.test.Int64Types.prototype.getInt64String = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.setInt64String = function(value) { + return jspb.Message.setField(this, 2, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.clearInt64String = function() { + return jspb.Message.setField(this, 2, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Int64Types.prototype.hasInt64String = function() { + return jspb.Message.getField(this, 2) != null; +}; + + +/** + * optional uint64 int64_number = 3; + * @return {number} + */ +proto.jspb.test.Int64Types.prototype.getInt64Number = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.setInt64Number = function(value) { + return jspb.Message.setField(this, 3, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Int64Types} returns this + */ +proto.jspb.test.Int64Types.prototype.clearInt64Number = function() { + return jspb.Message.setField(this, 3, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Int64Types.prototype.hasInt64Number = function() { + return jspb.Message.getField(this, 3) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestMapFieldsNoBinary.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestMapFieldsNoBinary} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestMapFieldsNoBinary.toObject = function(includeInstance, msg) { + var f, obj = { +mapStringStringMap: (f = msg.getMapStringStringMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringInt32Map: (f = msg.getMapStringInt32Map()) ? f.toObject(includeInstance, undefined) : [], +mapStringInt64Map: (f = msg.getMapStringInt64Map()) ? f.toObject(includeInstance, undefined) : [], +mapStringBoolMap: (f = msg.getMapStringBoolMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringDoubleMap: (f = msg.getMapStringDoubleMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringEnumMap: (f = msg.getMapStringEnumMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringMsgMap: (f = msg.getMapStringMsgMap()) ? f.toObject(includeInstance, proto.jspb.test.MapValueMessageNoBinary.toObject) : [], +mapInt32StringMap: (f = msg.getMapInt32StringMap()) ? f.toObject(includeInstance, undefined) : [], +mapInt64StringMap: (f = msg.getMapInt64StringMap()) ? f.toObject(includeInstance, undefined) : [], +mapBoolStringMap: (f = msg.getMapBoolStringMap()) ? f.toObject(includeInstance, undefined) : [], +testMapFields: (f = msg.getTestMapFields()) && proto.jspb.test.TestMapFieldsNoBinary.toObject(includeInstance, f), +mapStringTestmapfieldsMap: (f = msg.getMapStringTestmapfieldsMap()) ? f.toObject(includeInstance, proto.jspb.test.TestMapFieldsNoBinary.toObject) : [] + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} + */ +proto.jspb.test.TestMapFieldsNoBinary.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestMapFieldsNoBinary; + return proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestMapFieldsNoBinary} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} + */ +proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getMapStringStringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); + }); + break; + case 2: + var value = msg.getMapStringInt32Map(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt32, null, "", 0); + }); + break; + case 3: + var value = msg.getMapStringInt64Map(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt64, null, "", 0); + }); + break; + case 4: + var value = msg.getMapStringBoolMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readBool, null, "", false); + }); + break; + case 5: + var value = msg.getMapStringDoubleMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readDouble, null, "", 0.0); + }); + break; + case 6: + var value = msg.getMapStringEnumMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readEnum, null, "", 0); + }); + break; + case 7: + var value = msg.getMapStringMsgMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader, "", new proto.jspb.test.MapValueMessageNoBinary()); + }); + break; + case 8: + var value = msg.getMapInt32StringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt32, jspb.BinaryReader.prototype.readString, null, 0, ""); + }); + break; + case 9: + var value = msg.getMapInt64StringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt64, jspb.BinaryReader.prototype.readString, null, 0, ""); + }); + break; + case 10: + var value = msg.getMapBoolStringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readBool, jspb.BinaryReader.prototype.readString, null, false, ""); + }); + break; + case 11: + var value = new proto.jspb.test.TestMapFieldsNoBinary; + reader.readMessage(value,proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader); + msg.setTestMapFields(value); + break; + case 12: + var value = msg.getMapStringTestmapfieldsMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, proto.jspb.test.TestMapFieldsNoBinary.deserializeBinaryFromReader, "", new proto.jspb.test.TestMapFieldsNoBinary()); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestMapFieldsNoBinary} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getMapStringStringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); + } + f = message.getMapStringInt32Map(true); + if (f && f.getLength() > 0) { + f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt32); + } + f = message.getMapStringInt64Map(true); + if (f && f.getLength() > 0) { + f.serializeBinary(3, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt64); + } + f = message.getMapStringBoolMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(4, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeBool); + } + f = message.getMapStringDoubleMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(5, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeDouble); + } + f = message.getMapStringEnumMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(6, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeEnum); + } + f = message.getMapStringMsgMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(7, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter); + } + f = message.getMapInt32StringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(8, writer, jspb.BinaryWriter.prototype.writeInt32, jspb.BinaryWriter.prototype.writeString); + } + f = message.getMapInt64StringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(9, writer, jspb.BinaryWriter.prototype.writeInt64, jspb.BinaryWriter.prototype.writeString); + } + f = message.getMapBoolStringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(10, writer, jspb.BinaryWriter.prototype.writeBool, jspb.BinaryWriter.prototype.writeString); + } + f = message.getTestMapFields(); + if (f != null) { + writer.writeMessage( + 11, + f, + proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter + ); + } + f = message.getMapStringTestmapfieldsMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(12, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, proto.jspb.test.TestMapFieldsNoBinary.serializeBinaryToWriter); + } +}; + + +/** + * map map_string_string = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringStringMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringStringMap = function() { + this.getMapStringStringMap().clear(); + return this; +}; + + +/** + * map map_string_int32 = 2; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringInt32Map = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 2, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringInt32Map = function() { + this.getMapStringInt32Map().clear(); + return this; +}; + + +/** + * map map_string_int64 = 3; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringInt64Map = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 3, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringInt64Map = function() { + this.getMapStringInt64Map().clear(); + return this; +}; + + +/** + * map map_string_bool = 4; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringBoolMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 4, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringBoolMap = function() { + this.getMapStringBoolMap().clear(); + return this; +}; + + +/** + * map map_string_double = 5; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringDoubleMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 5, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringDoubleMap = function() { + this.getMapStringDoubleMap().clear(); + return this; +}; + + +/** + * map map_string_enum = 6; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringEnumMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 6, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringEnumMap = function() { + this.getMapStringEnumMap().clear(); + return this; +}; + + +/** + * map map_string_msg = 7; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringMsgMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 7, opt_noLazyCreate, + proto.jspb.test.MapValueMessageNoBinary)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringMsgMap = function() { + this.getMapStringMsgMap().clear(); + return this; +}; + + +/** + * map map_int32_string = 8; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapInt32StringMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 8, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapInt32StringMap = function() { + this.getMapInt32StringMap().clear(); + return this; +}; + + +/** + * map map_int64_string = 9; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapInt64StringMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 9, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapInt64StringMap = function() { + this.getMapInt64StringMap().clear(); + return this; +}; + + +/** + * map map_bool_string = 10; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapBoolStringMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 10, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapBoolStringMap = function() { + this.getMapBoolStringMap().clear(); + return this; +}; + + +/** + * optional TestMapFieldsNoBinary test_map_fields = 11; + * @return {?proto.jspb.test.TestMapFieldsNoBinary} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getTestMapFields = function() { + return /** @type{?proto.jspb.test.TestMapFieldsNoBinary} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.TestMapFieldsNoBinary, 11)); +}; + + +/** + * @param {?proto.jspb.test.TestMapFieldsNoBinary|undefined} value + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this +*/ +proto.jspb.test.TestMapFieldsNoBinary.prototype.setTestMapFields = function(value) { + return jspb.Message.setWrapperField(this, 11, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearTestMapFields = function() { + return this.setTestMapFields(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.hasTestMapFields = function() { + return jspb.Message.getField(this, 11) != null; +}; + + +/** + * map map_string_testmapfields = 12; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.getMapStringTestmapfieldsMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 12, opt_noLazyCreate, + proto.jspb.test.TestMapFieldsNoBinary)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ +proto.jspb.test.TestMapFieldsNoBinary.prototype.clearMapStringTestmapfieldsMap = function() { + this.getMapStringTestmapfieldsMap().clear(); + return this; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.MapValueMessageNoBinary.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.MapValueMessageNoBinary} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.MapValueMessageNoBinary.toObject = function(includeInstance, msg) { + var f, obj = { +foo: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.MapValueMessageNoBinary} + */ +proto.jspb.test.MapValueMessageNoBinary.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.MapValueMessageNoBinary; + return proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.MapValueMessageNoBinary} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.MapValueMessageNoBinary} + */ +proto.jspb.test.MapValueMessageNoBinary.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setFoo(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.MapValueMessageNoBinary} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.MapValueMessageNoBinary.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 foo = 1; + * @return {number} + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.getFoo = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.setFoo = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.clearFoo = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.MapValueMessageNoBinary.prototype.hasFoo = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Deeply.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Deeply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Deeply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Deeply} + */ +proto.jspb.test.Deeply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Deeply; + return proto.jspb.test.Deeply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Deeply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Deeply} + */ +proto.jspb.test.Deeply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Deeply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Deeply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Deeply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Deeply.Nested.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Deeply.Nested.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Deeply.Nested} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.Nested.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Deeply.Nested} + */ +proto.jspb.test.Deeply.Nested.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Deeply.Nested; + return proto.jspb.test.Deeply.Nested.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Deeply.Nested} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Deeply.Nested} + */ +proto.jspb.test.Deeply.Nested.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Deeply.Nested.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Deeply.Nested.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Deeply.Nested} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.Nested.serializeBinaryToWriter = function(message, writer) { + var f = undefined; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.Deeply.Nested.Message.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.Deeply.Nested.Message.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Deeply.Nested.Message} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.Nested.Message.toObject = function(includeInstance, msg) { + var f, obj = { +count: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Deeply.Nested.Message} + */ +proto.jspb.test.Deeply.Nested.Message.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.Deeply.Nested.Message; + return proto.jspb.test.Deeply.Nested.Message.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Deeply.Nested.Message} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Deeply.Nested.Message} + */ +proto.jspb.test.Deeply.Nested.Message.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setCount(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.Deeply.Nested.Message.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.Deeply.Nested.Message.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Deeply.Nested.Message} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.Deeply.Nested.Message.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } +}; + + +/** + * optional int32 count = 1; + * @return {number} + */ +proto.jspb.test.Deeply.Nested.Message.prototype.getCount = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.Deeply.Nested.Message} returns this + */ +proto.jspb.test.Deeply.Nested.Message.prototype.setCount = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Deeply.Nested.Message} returns this + */ +proto.jspb.test.Deeply.Nested.Message.prototype.clearCount = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.Deeply.Nested.Message.prototype.hasCount = function() { + return jspb.Message.getField(this, 1) != null; +}; + + +/** + * @enum {number} + */ +proto.jspb.test.OuterEnum = { + FOO: 1, + BAR: 2 +}; + +/** + * @enum {number} + */ +proto.jspb.test.MapValueEnumNoBinary = { + MAP_VALUE_FOO_NOBINARY: 0, + MAP_VALUE_BAR_NOBINARY: 1, + MAP_VALUE_BAZ_NOBINARY: 2 +}; + +/** + * @enum {number} + */ +proto.jspb.test.TestAllowAliasEnum = { + TEST_ALLOW_ALIAS_DEFAULT: 0, + VALUE1: 1 +}; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `simple1`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.simple1 = new jspb.ExtensionFieldInfo( + 105, + {simple1: 0}, + proto.jspb.test.Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.Simple1.toObject), + 0); + +proto.jspb.test.HasExtensions.extensionsBinary[105] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.simple1, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.Simple1.serializeBinaryToWriter, + proto.jspb.test.Simple1.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.HasExtensions.extensions[105] = proto.jspb.test.simple1; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extendTestLastFieldBeforePivotField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.extendTestLastFieldBeforePivotField = new jspb.ExtensionFieldInfo( + 101, + {extendTestLastFieldBeforePivotField: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.TestLastFieldBeforePivot.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.extendTestLastFieldBeforePivotField, + jspb.BinaryReader.prototype.readInt32, + jspb.BinaryWriter.prototype.writeInt32, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestLastFieldBeforePivot.extensions[101] = proto.jspb.test.extendTestLastFieldBeforePivotField; + diff --git a/example/test.closure.diff b/example/test.closure.diff new file mode 100644 index 00000000..e69de29b From 96e0016451d9def1cb70a5b2361cb120488017df Mon Sep 17 00:00:00 2001 From: Jacob Fugal Date: Fri, 21 Mar 2025 16:02:39 -0600 Subject: [PATCH 07/12] generate imports in .d.ts file, update example --- .bazelversion | 1 + example/README.md | 36 +- example/test.closure-new.js | 2 +- example/test.closure-old.js | 2 +- example/test.d.ts | 1 + example/test.js | 2 +- example/test2.closure-new.js | 650 ++++++++++++++++++++++++++++++++++ example/test2.closure-old.js | 650 ++++++++++++++++++++++++++++++++++ example/test2.closure.diff | 0 example/test2.d.ts | 50 +++ example/test2.js | 666 +++++++++++++++++++++++++++++++++++ generator/js_generator.cc | 11 +- 12 files changed, 2057 insertions(+), 14 deletions(-) create mode 100644 .bazelversion create mode 100644 example/test2.closure-new.js create mode 100644 example/test2.closure-old.js create mode 100644 example/test2.closure.diff create mode 100644 example/test2.d.ts create mode 100644 example/test2.js diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 00000000..6b0e58e7 --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +7.4.1 \ No newline at end of file diff --git a/example/README.md b/example/README.md index 78fa76ac..0e34ce30 100644 --- a/example/README.md +++ b/example/README.md @@ -1,21 +1,41 @@ # Generation -Built generator plugin: +To build example output: -`bazel build generator:protoc-gen-js` - -then: +``` +bazel build generator:protoc-gen-js +protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test,import_style=es6,generate_dts,binary:. protos/test.proto +protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test2,import_style=es6,generate_dts,binary:. protos/test2.proto +``` -`protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=protos --js_out=library=example/test,import_style=es6,generate_dts,binary:. protos/test.proto` +Generates all of: +* `example/test.js` +* `example/test2.js` +* `example/test.d.ts` +* `example/test2.d.ts` -Generated both `example/test.js` with ES6-style imports/exports and `example/test.d.ts` with TypeScript definitions. +The `*.js` files are generated with ES6-style imports/exports. The `*.d.ts` files have TypeScript definitions for their respective `.js` files. The `test2.*` files demonstrate dependency between generated files. To regression test Closure output: ``` git checkout origin/main -protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=protos --js_out=library=example/test,import_style=closure,binary:. protos/test.proto && mv example/test.js example/test.closure-old.js +bazel build generator:protoc-gen-js +protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test,import_style=closure,binary:. protos/test.proto +mv example/test.js example-test.js +protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test2,import_style=closure,binary:. protos/test2.proto +mv example/test2.js example-test2.js +rmdir example + git checkout lukfugl/es6 -protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=protos --js_out=library=example/test,import_style=closure,binary:. protos/test.proto && mv example/test.js example/test.closure-new.js +bazel build generator:protoc-gen-js +mv example-test.js example/test.closure-old.js +mv example-test2.js example/test2.closure-old.js +protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test,import_style=closure,binary:. protos/test.proto +mv example/test.js example/test.closure-new.js +protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test2,import_style=closure,binary:. protos/test2.proto +mv example/test2.js example/test2.closure-new.js + diff example/test.closure-* > example/test.closure.diff # empty +diff example/test2.closure-* > example/test2.closure.diff # empty ``` \ No newline at end of file diff --git a/example/test.closure-new.js b/example/test.closure-new.js index d1f8d940..7610c519 100644 --- a/example/test.closure-new.js +++ b/example/test.closure-new.js @@ -1,4 +1,4 @@ -// source: test.proto +// source: protos/test.proto /** * @fileoverview * @enhanceable diff --git a/example/test.closure-old.js b/example/test.closure-old.js index d1f8d940..7610c519 100644 --- a/example/test.closure-old.js +++ b/example/test.closure-old.js @@ -1,4 +1,4 @@ -// source: test.proto +// source: protos/test.proto /** * @fileoverview * @enhanceable diff --git a/example/test.d.ts b/example/test.d.ts index 918f9e59..036bc3df 100644 --- a/example/test.d.ts +++ b/example/test.d.ts @@ -1,4 +1,5 @@ import * as jspb from 'google-protobuf'; +import * as google_protobuf_descriptor_pb from 'google-protobuf/google/protobuf/descriptor.js'; export class Empty extends jspb.Message { constructor(data?: any[] | null); diff --git a/example/test.js b/example/test.js index bec1e968..f9656f25 100644 --- a/example/test.js +++ b/example/test.js @@ -1,4 +1,4 @@ -// source: test.proto +// source: protos/test.proto /** * @fileoverview * @enhanceable diff --git a/example/test2.closure-new.js b/example/test2.closure-new.js new file mode 100644 index 00000000..437a3df8 --- /dev/null +++ b/example/test2.closure-new.js @@ -0,0 +1,650 @@ +// source: protos/test2.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + + +goog.provide('proto.jspb.test.ExtensionMessage'); +goog.provide('proto.jspb.test.ForeignNestedFieldMessage'); +goog.provide('proto.jspb.test.TestExtensionsMessage'); +goog.provide('proto.jspb.test.floatingMsgField'); +goog.provide('proto.jspb.test.floatingStrField'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.ExtensionFieldBinaryInfo'); +goog.require('jspb.ExtensionFieldInfo'); +goog.require('jspb.Message'); +goog.require('proto.jspb.test.Deeply.Nested.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestExtensionsMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); +}; +goog.inherits(proto.jspb.test.TestExtensionsMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestExtensionsMessage.displayName = 'proto.jspb.test.TestExtensionsMessage'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestExtensionsMessage.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestExtensionsMessage.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.ExtensionMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.ExtensionMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.ExtensionMessage.displayName = 'proto.jspb.test.ExtensionMessage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.ForeignNestedFieldMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.ForeignNestedFieldMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.ForeignNestedFieldMessage.displayName = 'proto.jspb.test.ForeignNestedFieldMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestExtensionsMessage.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestExtensionsMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestExtensionsMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestExtensionsMessage.toObject = function(includeInstance, msg) { + var f, obj = { +intfield: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.TestExtensionsMessage.extensions, proto.jspb.test.TestExtensionsMessage.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestExtensionsMessage} + */ +proto.jspb.test.TestExtensionsMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestExtensionsMessage; + return proto.jspb.test.TestExtensionsMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestExtensionsMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestExtensionsMessage} + */ +proto.jspb.test.TestExtensionsMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setIntfield(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.TestExtensionsMessage.extensionsBinary, + proto.jspb.test.TestExtensionsMessage.prototype.getExtension, + proto.jspb.test.TestExtensionsMessage.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestExtensionsMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestExtensionsMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestExtensionsMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestExtensionsMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.TestExtensionsMessage.extensionsBinary, proto.jspb.test.TestExtensionsMessage.prototype.getExtension); +}; + + +/** + * optional int32 intfield = 1; + * @return {number} + */ +proto.jspb.test.TestExtensionsMessage.prototype.getIntfield = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestExtensionsMessage} returns this + */ +proto.jspb.test.TestExtensionsMessage.prototype.setIntfield = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestExtensionsMessage} returns this + */ +proto.jspb.test.TestExtensionsMessage.prototype.clearIntfield = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestExtensionsMessage.prototype.hasIntfield = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.ExtensionMessage.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.ExtensionMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.ExtensionMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.ExtensionMessage.toObject = function(includeInstance, msg) { + var f, obj = { +ext1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.ExtensionMessage} + */ +proto.jspb.test.ExtensionMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.ExtensionMessage; + return proto.jspb.test.ExtensionMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.ExtensionMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.ExtensionMessage} + */ +proto.jspb.test.ExtensionMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setExt1(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.ExtensionMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.ExtensionMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.ExtensionMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.ExtensionMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.ExtensionMessage.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + proto.jspb.test.ExtensionMessage, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.ExtensionMessage.toObject), + 0); + +proto.jspb.test.TestExtensionsMessage.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.ExtensionMessage.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.ExtensionMessage.serializeBinaryToWriter, + proto.jspb.test.ExtensionMessage.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestExtensionsMessage.extensions[100] = proto.jspb.test.ExtensionMessage.extField; + +/** + * optional string ext1 = 1; + * @return {string} + */ +proto.jspb.test.ExtensionMessage.prototype.getExt1 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.ExtensionMessage} returns this + */ +proto.jspb.test.ExtensionMessage.prototype.setExt1 = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.ExtensionMessage} returns this + */ +proto.jspb.test.ExtensionMessage.prototype.clearExt1 = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.ExtensionMessage.prototype.hasExt1 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.ForeignNestedFieldMessage.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.ForeignNestedFieldMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.ForeignNestedFieldMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.ForeignNestedFieldMessage.toObject = function(includeInstance, msg) { + var f, obj = { +deeplyNestedMessage: (f = msg.getDeeplyNestedMessage()) && proto.jspb.test.Deeply.Nested.Message.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.ForeignNestedFieldMessage} + */ +proto.jspb.test.ForeignNestedFieldMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.ForeignNestedFieldMessage; + return proto.jspb.test.ForeignNestedFieldMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.ForeignNestedFieldMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.ForeignNestedFieldMessage} + */ +proto.jspb.test.ForeignNestedFieldMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.jspb.test.Deeply.Nested.Message; + reader.readMessage(value,proto.jspb.test.Deeply.Nested.Message.deserializeBinaryFromReader); + msg.setDeeplyNestedMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.ForeignNestedFieldMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.ForeignNestedFieldMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.ForeignNestedFieldMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.ForeignNestedFieldMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDeeplyNestedMessage(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.jspb.test.Deeply.Nested.Message.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Deeply.Nested.Message deeply_nested_message = 1; + * @return {?proto.jspb.test.Deeply.Nested.Message} + */ +proto.jspb.test.ForeignNestedFieldMessage.prototype.getDeeplyNestedMessage = function() { + return /** @type{?proto.jspb.test.Deeply.Nested.Message} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Deeply.Nested.Message, 1)); +}; + + +/** + * @param {?proto.jspb.test.Deeply.Nested.Message|undefined} value + * @return {!proto.jspb.test.ForeignNestedFieldMessage} returns this +*/ +proto.jspb.test.ForeignNestedFieldMessage.prototype.setDeeplyNestedMessage = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.ForeignNestedFieldMessage} returns this + */ +proto.jspb.test.ForeignNestedFieldMessage.prototype.clearDeeplyNestedMessage = function() { + return this.setDeeplyNestedMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.ForeignNestedFieldMessage.prototype.hasDeeplyNestedMessage = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `floatingMsgField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.floatingMsgField = new jspb.ExtensionFieldInfo( + 101, + {floatingMsgField: 0}, + proto.jspb.test.ExtensionMessage, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.ExtensionMessage.toObject), + 0); + +proto.jspb.test.TestExtensionsMessage.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.floatingMsgField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.ExtensionMessage.serializeBinaryToWriter, + proto.jspb.test.ExtensionMessage.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestExtensionsMessage.extensions[101] = proto.jspb.test.floatingMsgField; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `floatingStrField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.floatingStrField = new jspb.ExtensionFieldInfo( + 102, + {floatingStrField: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.TestExtensionsMessage.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.floatingStrField, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestExtensionsMessage.extensions[102] = proto.jspb.test.floatingStrField; + diff --git a/example/test2.closure-old.js b/example/test2.closure-old.js new file mode 100644 index 00000000..437a3df8 --- /dev/null +++ b/example/test2.closure-old.js @@ -0,0 +1,650 @@ +// source: protos/test2.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + + +goog.provide('proto.jspb.test.ExtensionMessage'); +goog.provide('proto.jspb.test.ForeignNestedFieldMessage'); +goog.provide('proto.jspb.test.TestExtensionsMessage'); +goog.provide('proto.jspb.test.floatingMsgField'); +goog.provide('proto.jspb.test.floatingStrField'); + +goog.require('jspb.BinaryReader'); +goog.require('jspb.BinaryWriter'); +goog.require('jspb.ExtensionFieldBinaryInfo'); +goog.require('jspb.ExtensionFieldInfo'); +goog.require('jspb.Message'); +goog.require('proto.jspb.test.Deeply.Nested.Message'); + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.TestExtensionsMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); +}; +goog.inherits(proto.jspb.test.TestExtensionsMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.TestExtensionsMessage.displayName = 'proto.jspb.test.TestExtensionsMessage'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestExtensionsMessage.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +proto.jspb.test.TestExtensionsMessage.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.ExtensionMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.ExtensionMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.ExtensionMessage.displayName = 'proto.jspb.test.ExtensionMessage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.jspb.test.ForeignNestedFieldMessage = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.jspb.test.ForeignNestedFieldMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.jspb.test.ForeignNestedFieldMessage.displayName = 'proto.jspb.test.ForeignNestedFieldMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.TestExtensionsMessage.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.TestExtensionsMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestExtensionsMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestExtensionsMessage.toObject = function(includeInstance, msg) { + var f, obj = { +intfield: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + proto.jspb.test.TestExtensionsMessage.extensions, proto.jspb.test.TestExtensionsMessage.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestExtensionsMessage} + */ +proto.jspb.test.TestExtensionsMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.TestExtensionsMessage; + return proto.jspb.test.TestExtensionsMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestExtensionsMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestExtensionsMessage} + */ +proto.jspb.test.TestExtensionsMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setIntfield(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + proto.jspb.test.TestExtensionsMessage.extensionsBinary, + proto.jspb.test.TestExtensionsMessage.prototype.getExtension, + proto.jspb.test.TestExtensionsMessage.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.TestExtensionsMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.TestExtensionsMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestExtensionsMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.TestExtensionsMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + proto.jspb.test.TestExtensionsMessage.extensionsBinary, proto.jspb.test.TestExtensionsMessage.prototype.getExtension); +}; + + +/** + * optional int32 intfield = 1; + * @return {number} + */ +proto.jspb.test.TestExtensionsMessage.prototype.getIntfield = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestExtensionsMessage} returns this + */ +proto.jspb.test.TestExtensionsMessage.prototype.setIntfield = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestExtensionsMessage} returns this + */ +proto.jspb.test.TestExtensionsMessage.prototype.clearIntfield = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.TestExtensionsMessage.prototype.hasIntfield = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.ExtensionMessage.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.ExtensionMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.ExtensionMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.ExtensionMessage.toObject = function(includeInstance, msg) { + var f, obj = { +ext1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.ExtensionMessage} + */ +proto.jspb.test.ExtensionMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.ExtensionMessage; + return proto.jspb.test.ExtensionMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.ExtensionMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.ExtensionMessage} + */ +proto.jspb.test.ExtensionMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setExt1(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.ExtensionMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.ExtensionMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.ExtensionMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.ExtensionMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.ExtensionMessage.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + proto.jspb.test.ExtensionMessage, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.ExtensionMessage.toObject), + 0); + +proto.jspb.test.TestExtensionsMessage.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.ExtensionMessage.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.ExtensionMessage.serializeBinaryToWriter, + proto.jspb.test.ExtensionMessage.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestExtensionsMessage.extensions[100] = proto.jspb.test.ExtensionMessage.extField; + +/** + * optional string ext1 = 1; + * @return {string} + */ +proto.jspb.test.ExtensionMessage.prototype.getExt1 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.ExtensionMessage} returns this + */ +proto.jspb.test.ExtensionMessage.prototype.setExt1 = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.ExtensionMessage} returns this + */ +proto.jspb.test.ExtensionMessage.prototype.clearExt1 = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.ExtensionMessage.prototype.hasExt1 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.jspb.test.ForeignNestedFieldMessage.prototype.toObject = function(opt_includeInstance) { + return proto.jspb.test.ForeignNestedFieldMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.ForeignNestedFieldMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.ForeignNestedFieldMessage.toObject = function(includeInstance, msg) { + var f, obj = { +deeplyNestedMessage: (f = msg.getDeeplyNestedMessage()) && proto.jspb.test.Deeply.Nested.Message.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.ForeignNestedFieldMessage} + */ +proto.jspb.test.ForeignNestedFieldMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.jspb.test.ForeignNestedFieldMessage; + return proto.jspb.test.ForeignNestedFieldMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.ForeignNestedFieldMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.ForeignNestedFieldMessage} + */ +proto.jspb.test.ForeignNestedFieldMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.jspb.test.Deeply.Nested.Message; + reader.readMessage(value,proto.jspb.test.Deeply.Nested.Message.deserializeBinaryFromReader); + msg.setDeeplyNestedMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.jspb.test.ForeignNestedFieldMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.jspb.test.ForeignNestedFieldMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.ForeignNestedFieldMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.jspb.test.ForeignNestedFieldMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDeeplyNestedMessage(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.jspb.test.Deeply.Nested.Message.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Deeply.Nested.Message deeply_nested_message = 1; + * @return {?proto.jspb.test.Deeply.Nested.Message} + */ +proto.jspb.test.ForeignNestedFieldMessage.prototype.getDeeplyNestedMessage = function() { + return /** @type{?proto.jspb.test.Deeply.Nested.Message} */ ( + jspb.Message.getWrapperField(this, proto.jspb.test.Deeply.Nested.Message, 1)); +}; + + +/** + * @param {?proto.jspb.test.Deeply.Nested.Message|undefined} value + * @return {!proto.jspb.test.ForeignNestedFieldMessage} returns this +*/ +proto.jspb.test.ForeignNestedFieldMessage.prototype.setDeeplyNestedMessage = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.ForeignNestedFieldMessage} returns this + */ +proto.jspb.test.ForeignNestedFieldMessage.prototype.clearDeeplyNestedMessage = function() { + return this.setDeeplyNestedMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.jspb.test.ForeignNestedFieldMessage.prototype.hasDeeplyNestedMessage = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `floatingMsgField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.floatingMsgField = new jspb.ExtensionFieldInfo( + 101, + {floatingMsgField: 0}, + proto.jspb.test.ExtensionMessage, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + proto.jspb.test.ExtensionMessage.toObject), + 0); + +proto.jspb.test.TestExtensionsMessage.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.floatingMsgField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + proto.jspb.test.ExtensionMessage.serializeBinaryToWriter, + proto.jspb.test.ExtensionMessage.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestExtensionsMessage.extensions[101] = proto.jspb.test.floatingMsgField; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `floatingStrField`. + * @type {!jspb.ExtensionFieldInfo} + */ +proto.jspb.test.floatingStrField = new jspb.ExtensionFieldInfo( + 102, + {floatingStrField: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +proto.jspb.test.TestExtensionsMessage.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( + proto.jspb.test.floatingStrField, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +proto.jspb.test.TestExtensionsMessage.extensions[102] = proto.jspb.test.floatingStrField; + diff --git a/example/test2.closure.diff b/example/test2.closure.diff new file mode 100644 index 00000000..e69de29b diff --git a/example/test2.d.ts b/example/test2.d.ts new file mode 100644 index 00000000..acdc5e1c --- /dev/null +++ b/example/test2.d.ts @@ -0,0 +1,50 @@ +import * as jspb from 'google-protobuf'; + +// comment added after generation for code review: +// ""../protos/" as the path is probably not correct. i.e. here it shouild be either './' or '../example/' +// ideally in the code we'd replace `proto_path` from the command line with `options.output_dir`. I don't see an +// easy way to get at `proto_path`, though, since that parameter goes directly to `protoc`, not to the plugin. +import * as protos_test_pb from '../protos/test.js'; + +export class TestExtensionsMessage extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: TestExtensionsMessage): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): TestExtensionsMessage; + static deserializeBinaryFromReader(msg: TestExtensionsMessage, reader: jspb.BinaryReader): TestExtensionsMessage; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: TestExtensionsMessage, writer: jspb.BinaryWriter): void; + getIntfield(): number; + setIntfield(value: number): TestExtensionsMessage; + clearIntfield(): TestExtensionsMessage; + hasIntfield(): boolean; +} + +export class ExtensionMessage extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: ExtensionMessage): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): ExtensionMessage; + static deserializeBinaryFromReader(msg: ExtensionMessage, reader: jspb.BinaryReader): ExtensionMessage; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: ExtensionMessage, writer: jspb.BinaryWriter): void; + getExt1(): string; + setExt1(value: string): ExtensionMessage; + clearExt1(): ExtensionMessage; + hasExt1(): boolean; +} + +export class ForeignNestedFieldMessage extends jspb.Message { + constructor(data?: any[] | null); + toObject(includeInstance?: boolean): { [key: string]: unknown }; + static toObject(includeInstance: boolean | undefined, msg: ForeignNestedFieldMessage): { [key: string]: unknown }; + static deserializeBinary(bytes: jspb.ByteSource): ForeignNestedFieldMessage; + static deserializeBinaryFromReader(msg: ForeignNestedFieldMessage, reader: jspb.BinaryReader): ForeignNestedFieldMessage; + serializeBinary(): Uint8Array; + static serializeBinaryToWriter(message: ForeignNestedFieldMessage, writer: jspb.BinaryWriter): void; + getDeeplyNestedMessage(): protos_test_pb.Deeply.Nested.Message | null; + setDeeplyNestedMessage(value: protos_test_pb.Deeply.Nested.Message | null | undefined): ForeignNestedFieldMessage; + clearDeeplyNestedMessage(): ForeignNestedFieldMessage; + hasDeeplyNestedMessage(): boolean; +} + diff --git a/example/test2.js b/example/test2.js new file mode 100644 index 00000000..d249379b --- /dev/null +++ b/example/test2.js @@ -0,0 +1,666 @@ +// source: protos/test2.proto +/** + * @fileoverview + * @enhanceable + * @suppress {missingRequire} reports error on implicit type usages. + * @suppress {messageConventions} JS Compiler reports an error if a variable or + * field starts with 'MSG_' and isn't a translatable message. + * @public + */ +// GENERATED CODE -- DO NOT EDIT! +/* eslint-disable */ +// @ts-nocheck + +import * as jspb from 'google-protobuf'; +var goog = jspb; +var proto = {}; + +import * as protos_test_pb from '../protos/test.js'; +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +export function TestExtensionsMessage(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); +}; +goog.inherits(TestExtensionsMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestExtensionsMessage.displayName = 'proto.jspb.test.TestExtensionsMessage'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +TestExtensionsMessage.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +TestExtensionsMessage.extensionsBinary = {}; + +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +export function ExtensionMessage(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(ExtensionMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + ExtensionMessage.displayName = 'proto.jspb.test.ExtensionMessage'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +export function ForeignNestedFieldMessage(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(ForeignNestedFieldMessage, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + ForeignNestedFieldMessage.displayName = 'proto.jspb.test.ForeignNestedFieldMessage'; +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +TestExtensionsMessage.prototype.toObject = function(opt_includeInstance) { + return TestExtensionsMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestExtensionsMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +TestExtensionsMessage.toObject = function(includeInstance, msg) { + var f, obj = { +intfield: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + TestExtensionsMessage.extensions, TestExtensionsMessage.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestExtensionsMessage} + */ +TestExtensionsMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestExtensionsMessage; + return TestExtensionsMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestExtensionsMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestExtensionsMessage} + */ +TestExtensionsMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setIntfield(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + TestExtensionsMessage.extensionsBinary, + TestExtensionsMessage.prototype.getExtension, + TestExtensionsMessage.prototype.setExtension); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +TestExtensionsMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + TestExtensionsMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestExtensionsMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +TestExtensionsMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + TestExtensionsMessage.extensionsBinary, TestExtensionsMessage.prototype.getExtension); +}; + + +/** + * optional int32 intfield = 1; + * @return {number} + */ +TestExtensionsMessage.prototype.getIntfield = function() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); +}; + + +/** + * @param {number} value + * @return {!proto.jspb.test.TestExtensionsMessage} returns this + */ +TestExtensionsMessage.prototype.setIntfield = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestExtensionsMessage} returns this + */ +TestExtensionsMessage.prototype.clearIntfield = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +TestExtensionsMessage.prototype.hasIntfield = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +ExtensionMessage.prototype.toObject = function(opt_includeInstance) { + return ExtensionMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.ExtensionMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +ExtensionMessage.toObject = function(includeInstance, msg) { + var f, obj = { +ext1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.ExtensionMessage} + */ +ExtensionMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new ExtensionMessage; + return ExtensionMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.ExtensionMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.ExtensionMessage} + */ +ExtensionMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setExt1(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +ExtensionMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + ExtensionMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.ExtensionMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +ExtensionMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +ExtensionMessage.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + ExtensionMessage, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + ExtensionMessage.toObject), + 0); + +TestExtensionsMessage.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + ExtensionMessage.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + ExtensionMessage.serializeBinaryToWriter, + ExtensionMessage.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +TestExtensionsMessage.extensions[100] = ExtensionMessage.extField; + +/** + * optional string ext1 = 1; + * @return {string} + */ +ExtensionMessage.prototype.getExt1 = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.jspb.test.ExtensionMessage} returns this + */ +ExtensionMessage.prototype.setExt1 = function(value) { + return jspb.Message.setField(this, 1, value); +}; + + +/** + * Clears the field making it undefined. + * @return {!proto.jspb.test.ExtensionMessage} returns this + */ +ExtensionMessage.prototype.clearExt1 = function() { + return jspb.Message.setField(this, 1, undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +ExtensionMessage.prototype.hasExt1 = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +ExtensionMessage.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + ExtensionMessage, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + ExtensionMessage.toObject), + 0); + +TestExtensionsMessage.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + ExtensionMessage.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + ExtensionMessage.serializeBinaryToWriter, + ExtensionMessage.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +TestExtensionsMessage.extensions[100] = ExtensionMessage.extField; + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +ForeignNestedFieldMessage.prototype.toObject = function(opt_includeInstance) { + return ForeignNestedFieldMessage.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.ForeignNestedFieldMessage} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +ForeignNestedFieldMessage.toObject = function(includeInstance, msg) { + var f, obj = { +deeplyNestedMessage: (f = msg.getDeeplyNestedMessage()) && protos_test_pb.Deeply.Nested.Message.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.ForeignNestedFieldMessage} + */ +ForeignNestedFieldMessage.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new ForeignNestedFieldMessage; + return ForeignNestedFieldMessage.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.ForeignNestedFieldMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.ForeignNestedFieldMessage} + */ +ForeignNestedFieldMessage.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new protos_test_pb.Deeply.Nested.Message; + reader.readMessage(value,protos_test_pb.Deeply.Nested.Message.deserializeBinaryFromReader); + msg.setDeeplyNestedMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +ForeignNestedFieldMessage.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + ForeignNestedFieldMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.ForeignNestedFieldMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +ForeignNestedFieldMessage.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getDeeplyNestedMessage(); + if (f != null) { + writer.writeMessage( + 1, + f, + protos_test_pb.Deeply.Nested.Message.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Deeply.Nested.Message deeply_nested_message = 1; + * @return {?proto.jspb.test.Deeply.Nested.Message} + */ +ForeignNestedFieldMessage.prototype.getDeeplyNestedMessage = function() { + return /** @type{?proto.jspb.test.Deeply.Nested.Message} */ ( + jspb.Message.getWrapperField(this, protos_test_pb.Deeply.Nested.Message, 1)); +}; + + +/** + * @param {?proto.jspb.test.Deeply.Nested.Message|undefined} value + * @return {!proto.jspb.test.ForeignNestedFieldMessage} returns this +*/ +ForeignNestedFieldMessage.prototype.setDeeplyNestedMessage = function(value) { + return jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.ForeignNestedFieldMessage} returns this + */ +ForeignNestedFieldMessage.prototype.clearDeeplyNestedMessage = function() { + return this.setDeeplyNestedMessage(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +ForeignNestedFieldMessage.prototype.hasDeeplyNestedMessage = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `floatingMsgField`. + * @type {!jspb.ExtensionFieldInfo} + */ +export const floatingMsgField = new jspb.ExtensionFieldInfo( + 101, + {floatingMsgField: 0}, + ExtensionMessage, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + ExtensionMessage.toObject), + 0); + +TestExtensionsMessage.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( + floatingMsgField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + ExtensionMessage.serializeBinaryToWriter, + ExtensionMessage.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +TestExtensionsMessage.extensions[101] = floatingMsgField; + + +/** + * A tuple of {field number, class constructor} for the extension + * field named `floatingStrField`. + * @type {!jspb.ExtensionFieldInfo} + */ +export const floatingStrField = new jspb.ExtensionFieldInfo( + 102, + {floatingStrField: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +TestExtensionsMessage.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( + floatingStrField, + jspb.BinaryReader.prototype.readString, + jspb.BinaryWriter.prototype.writeString, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +TestExtensionsMessage.extensions[102] = floatingStrField; + diff --git a/generator/js_generator.cc b/generator/js_generator.cc index 3a775189..59e5577e 100644 --- a/generator/js_generator.cc +++ b/generator/js_generator.cc @@ -3930,9 +3930,14 @@ const std::string DTS_INDENT = " "; void Generator::GenerateDTS(const GeneratorOptions& options, io::Printer* printer, const FileDescriptor* file) const { - printer->Print("import * as jspb from 'google-protobuf';\n\n"); - - // determine other imports + printer->Print("import * as jspb from 'google-protobuf';\n"); + for (int i = 0; i < file->dependency_count(); i++) { + const std::string& name = file->dependency(i)->name(); + printer->Print( + "import * as $alias$ from '$file$';\n", "alias", ModuleAlias(name), + "file", GetRootPath(file->name(), name) + GetJSFilename(options, name)); + } + printer->Print("\n"); for (int i = 0; i < file->message_type_count(); i++) { auto desc = file->message_type(i); From 081667798752a2a1799e2a267c923d10fdddcdb1 Mon Sep 17 00:00:00 2001 From: Jacob Fugal Date: Tue, 1 Apr 2025 15:04:05 -0600 Subject: [PATCH 08/12] generate code as ES6 classes --- example/test.js | 14495 +++++++++++++++++------------------- example/test2.js | 789 +- generator/js_generator.cc | 706 +- generator/js_generator.h | 31 +- 4 files changed, 7889 insertions(+), 8132 deletions(-) diff --git a/example/test.js b/example/test.js index f9656f25..a78b63c7 100644 --- a/example/test.js +++ b/example/test.js @@ -16,902 +16,78 @@ var goog = jspb; var proto = {}; import * as google_protobuf_descriptor_pb from 'google-protobuf/google/protobuf/descriptor.js'; -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function Empty(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(Empty, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - Empty.displayName = 'proto.jspb.test.Empty'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function EnumContainer(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(EnumContainer, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - EnumContainer.displayName = 'proto.jspb.test.EnumContainer'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function Simple1(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, Simple1.repeatedFields_, null); -}; -goog.inherits(Simple1, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - Simple1.displayName = 'proto.jspb.test.Simple1'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function Simple2(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, Simple2.repeatedFields_, null); -}; -goog.inherits(Simple2, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - Simple2.displayName = 'proto.jspb.test.Simple2'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function SpecialCases(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(SpecialCases, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - SpecialCases.displayName = 'proto.jspb.test.SpecialCases'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function OptionalFields(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, OptionalFields.repeatedFields_, null); -}; -goog.inherits(OptionalFields, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - OptionalFields.displayName = 'proto.jspb.test.OptionalFields'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -OptionalFields.Nested = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(OptionalFields.Nested, jspb.Message); -if (goog.DEBUG && !COMPILED) { +export class Empty extends jspb.Message { /** - * @public - * @override + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor */ - OptionalFields.Nested.displayName = 'proto.jspb.test.OptionalFields.Nested'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function HasExtensions(opt_data) { - jspb.Message.initialize(this, opt_data, 0, 4, null, null); -}; -goog.inherits(HasExtensions, jspb.Message); -if (goog.DEBUG && !COMPILED) { + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; /** - * @public - * @override + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Empty} */ - HasExtensions.displayName = 'proto.jspb.test.HasExtensions'; -} - -/** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ -HasExtensions.extensions = {}; - + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new Empty; + return Empty.deserializeBinaryFromReader(msg, reader); + }; -/** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ -HasExtensions.extensionsBinary = {}; -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function Complex(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, Complex.repeatedFields_, null); -}; -goog.inherits(Complex, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - Complex.displayName = 'proto.jspb.test.Complex'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -Complex.Nested = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(Complex.Nested, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - Complex.Nested.displayName = 'proto.jspb.test.Complex.Nested'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function OuterMessage(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(OuterMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - OuterMessage.displayName = 'proto.jspb.test.OuterMessage'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -OuterMessage.Complex = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(OuterMessage.Complex, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - OuterMessage.Complex.displayName = 'proto.jspb.test.OuterMessage.Complex'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function MineField(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(MineField, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - MineField.displayName = 'proto.jspb.test.MineField'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function IsExtension(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(IsExtension, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - IsExtension.displayName = 'proto.jspb.test.IsExtension'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function IndirectExtension(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(IndirectExtension, jspb.Message); -if (goog.DEBUG && !COMPILED) { /** - * @public - * @override + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Empty} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Empty} */ - IndirectExtension.displayName = 'proto.jspb.test.IndirectExtension'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function DefaultValues(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(DefaultValues, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - DefaultValues.displayName = 'proto.jspb.test.DefaultValues'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function FloatingPointFields(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, FloatingPointFields.repeatedFields_, null); -}; -goog.inherits(FloatingPointFields, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - FloatingPointFields.displayName = 'proto.jspb.test.FloatingPointFields'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function BooleanFields(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, BooleanFields.repeatedFields_, null); -}; -goog.inherits(BooleanFields, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - BooleanFields.displayName = 'proto.jspb.test.BooleanFields'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function TestClone(opt_data) { - jspb.Message.initialize(this, opt_data, 0, 8, TestClone.repeatedFields_, null); -}; -goog.inherits(TestClone, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - TestClone.displayName = 'proto.jspb.test.TestClone'; -} - -/** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ -TestClone.extensions = {}; + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ -TestClone.extensionsBinary = {}; - -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function TestCloneExtension(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(TestCloneExtension, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - TestCloneExtension.displayName = 'proto.jspb.test.TestCloneExtension'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function CloneExtension(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(CloneExtension, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - CloneExtension.displayName = 'proto.jspb.test.CloneExtension'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function TestGroup(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, TestGroup.repeatedFields_, null); -}; -goog.inherits(TestGroup, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - TestGroup.displayName = 'proto.jspb.test.TestGroup'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -TestGroup.RepeatedGroup = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, TestGroup.RepeatedGroup.repeatedFields_, null); -}; -goog.inherits(TestGroup.RepeatedGroup, jspb.Message); -if (goog.DEBUG && !COMPILED) { /** - * @public - * @override + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} */ - TestGroup.RepeatedGroup.displayName = 'proto.jspb.test.TestGroup.RepeatedGroup'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -TestGroup.RequiredGroup = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(TestGroup.RequiredGroup, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - TestGroup.RequiredGroup.displayName = 'proto.jspb.test.TestGroup.RequiredGroup'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -TestGroup.OptionalGroup = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(TestGroup.OptionalGroup, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - TestGroup.OptionalGroup.displayName = 'proto.jspb.test.TestGroup.OptionalGroup'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function TestGroup1(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(TestGroup1, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - TestGroup1.displayName = 'proto.jspb.test.TestGroup1'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function TestReservedNames(opt_data) { - jspb.Message.initialize(this, opt_data, 0, 2, null, null); -}; -goog.inherits(TestReservedNames, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - TestReservedNames.displayName = 'proto.jspb.test.TestReservedNames'; -} - -/** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ -TestReservedNames.extensions = {}; - + serializeBinary() { + var writer = new jspb.BinaryWriter(); + Empty.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ -TestReservedNames.extensionsBinary = {}; -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function TestReservedNamesExtension(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(TestReservedNamesExtension, jspb.Message); -if (goog.DEBUG && !COMPILED) { /** - * @public - * @override + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Empty} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages */ - TestReservedNamesExtension.displayName = 'proto.jspb.test.TestReservedNamesExtension'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function TestMessageWithOneof(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, TestMessageWithOneof.repeatedFields_, TestMessageWithOneof.oneofGroups_); -}; -goog.inherits(TestMessageWithOneof, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - TestMessageWithOneof.displayName = 'proto.jspb.test.TestMessageWithOneof'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function TestEndsWithBytes(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(TestEndsWithBytes, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - TestEndsWithBytes.displayName = 'proto.jspb.test.TestEndsWithBytes'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function TestLastFieldBeforePivot(opt_data) { - jspb.Message.initialize(this, opt_data, 0, 2, null, null); -}; -goog.inherits(TestLastFieldBeforePivot, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - TestLastFieldBeforePivot.displayName = 'proto.jspb.test.TestLastFieldBeforePivot'; -} - -/** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ -TestLastFieldBeforePivot.extensions = {}; + static serializeBinaryToWriter(message, writer) { + var f = undefined; + }; -/** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ -TestLastFieldBeforePivot.extensionsBinary = {}; - -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function Int64Types(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(Int64Types, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - Int64Types.displayName = 'proto.jspb.test.Int64Types'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function TestMapFieldsNoBinary(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(TestMapFieldsNoBinary, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - TestMapFieldsNoBinary.displayName = 'proto.jspb.test.TestMapFieldsNoBinary'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function MapValueMessageNoBinary(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(MapValueMessageNoBinary, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - MapValueMessageNoBinary.displayName = 'proto.jspb.test.MapValueMessageNoBinary'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function Deeply(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(Deeply, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - Deeply.displayName = 'proto.jspb.test.Deeply'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -Deeply.Nested = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(Deeply.Nested, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - Deeply.Nested.displayName = 'proto.jspb.test.Deeply.Nested'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -Deeply.Nested.Message = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(Deeply.Nested.Message, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - Deeply.Nested.Message.displayName = 'proto.jspb.test.Deeply.Nested.Message'; } @@ -956,219 +132,126 @@ Empty.toObject = function(includeInstance, msg) { } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Empty} - */ -Empty.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new Empty; - return Empty.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.Empty} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Empty} - */ -Empty.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -Empty.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - Empty.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Empty} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -Empty.serializeBinaryToWriter = function(message, writer) { - var f = undefined; -}; - +export class EnumContainer extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * optional OuterEnum outer_enum = 1; + * @return {!proto.jspb.test.OuterEnum} + */ + getOuterEnum() { + return /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getFieldWithDefault(this, 1, 1)); + }; + /** + * @param {!proto.jspb.test.OuterEnum} value + * @return {!proto.jspb.test.EnumContainer} returns this + */ + setOuterEnum(value) { + return jspb.Message.setField(this, 1, value); + }; -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -EnumContainer.prototype.toObject = function(opt_includeInstance) { - return EnumContainer.toObject(opt_includeInstance, this); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.EnumContainer} returns this + */ + clearOuterEnum() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.jspb.test.EnumContainer} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -EnumContainer.toObject = function(includeInstance, msg) { - var f, obj = { -outerEnum: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasOuterEnum() { + return jspb.Message.getField(this, 1) != null; }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.EnumContainer} - */ -EnumContainer.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new EnumContainer; - return EnumContainer.deserializeBinaryFromReader(msg, reader); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.EnumContainer} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new EnumContainer; + return EnumContainer.deserializeBinaryFromReader(msg, reader); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.EnumContainer} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.EnumContainer} - */ -EnumContainer.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {!proto.jspb.test.OuterEnum} */ (reader.readEnum()); - msg.setOuterEnum(value); - break; - default: - reader.skipField(); - break; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.EnumContainer} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.EnumContainer} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {!proto.jspb.test.OuterEnum} */ (reader.readEnum()); + msg.setOuterEnum(value); + break; + default: + reader.skipField(); + break; + } } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -EnumContainer.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - EnumContainer.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.EnumContainer} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -EnumContainer.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeEnum( - 1, - f - ); - } -}; - - -/** - * optional OuterEnum outer_enum = 1; - * @return {!proto.jspb.test.OuterEnum} - */ -EnumContainer.prototype.getOuterEnum = function() { - return /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getFieldWithDefault(this, 1, 1)); -}; - - -/** - * @param {!proto.jspb.test.OuterEnum} value - * @return {!proto.jspb.test.EnumContainer} returns this - */ -EnumContainer.prototype.setOuterEnum = function(value) { - return jspb.Message.setField(this, 1, value); -}; - + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.EnumContainer} returns this - */ -EnumContainer.prototype.clearOuterEnum = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + EnumContainer.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -EnumContainer.prototype.hasOuterEnum = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.EnumContainer} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeEnum( + 1, + f + ); + } + }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -Simple1.repeatedFields_ = [2]; +} @@ -1185,8 +268,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -Simple1.prototype.toObject = function(opt_includeInstance) { - return Simple1.toObject(opt_includeInstance, this); +EnumContainer.prototype.toObject = function(opt_includeInstance) { + return EnumContainer.toObject(opt_includeInstance, this); }; @@ -1195,15 +278,13 @@ Simple1.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Simple1} msg The msg instance to transform. + * @param {!proto.jspb.test.EnumContainer} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -Simple1.toObject = function(includeInstance, msg) { +EnumContainer.toObject = function(includeInstance, msg) { var f, obj = { -aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, -aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f, -aBoolean: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f +outerEnum: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; if (includeInstance) { @@ -1214,213 +295,228 @@ aBoolean: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Simple1} - */ -Simple1.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new Simple1; - return Simple1.deserializeBinaryFromReader(msg, reader); -}; - +export class Simple1 extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, Simple1.repeatedFields_, null); + }; + /** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ + static repeatedFields_ = [2]; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.Simple1} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Simple1} - */ -Simple1.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setAString(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.addARepeatedString(value); - break; - case 3: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setABoolean(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * required string a_string = 1; + * @return {string} + */ + getAString() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -Simple1.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - Simple1.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.Simple1} returns this + */ + setAString(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Simple1} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -Simple1.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeString( - 1, - f - ); - } - f = message.getARepeatedStringList(); - if (f.length > 0) { - writer.writeRepeatedString( - 2, - f - ); - } - f = /** @type {boolean} */ (jspb.Message.getField(message, 3)); - if (f != null) { - writer.writeBool( - 3, - f - ); - } -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Simple1} returns this + */ + clearAString() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * required string a_string = 1; - * @return {string} - */ -Simple1.prototype.getAString = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasAString() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * @param {string} value - * @return {!proto.jspb.test.Simple1} returns this - */ -Simple1.prototype.setAString = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * repeated string a_repeated_string = 2; + * @return {!Array} + */ + getARepeatedStringList() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.Simple1} returns this - */ -Simple1.prototype.clearAString = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.Simple1} returns this + */ + setARepeatedStringList(value) { + return jspb.Message.setField(this, 2, value || []); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -Simple1.prototype.hasAString = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.Simple1} returns this + */ + addARepeatedString(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); + }; -/** - * repeated string a_repeated_string = 2; - * @return {!Array} - */ -Simple1.prototype.getARepeatedStringList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Simple1} returns this + */ + clearARepeatedStringList() { + return this.setARepeatedStringList([]); + }; -/** - * @param {!Array} value - * @return {!proto.jspb.test.Simple1} returns this - */ -Simple1.prototype.setARepeatedStringList = function(value) { - return jspb.Message.setField(this, 2, value || []); -}; + /** + * optional bool a_boolean = 3; + * @return {boolean} + */ + getABoolean() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); + }; -/** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.jspb.test.Simple1} returns this - */ -Simple1.prototype.addARepeatedString = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 2, value, opt_index); -}; + /** + * @param {boolean} value + * @return {!proto.jspb.test.Simple1} returns this + */ + setABoolean(value) { + return jspb.Message.setField(this, 3, value); + }; -/** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.Simple1} returns this - */ -Simple1.prototype.clearARepeatedStringList = function() { - return this.setARepeatedStringList([]); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Simple1} returns this + */ + clearABoolean() { + return jspb.Message.setField(this, 3, undefined); + }; -/** - * optional bool a_boolean = 3; - * @return {boolean} - */ -Simple1.prototype.getABoolean = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false)); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasABoolean() { + return jspb.Message.getField(this, 3) != null; + }; -/** - * @param {boolean} value - * @return {!proto.jspb.test.Simple1} returns this - */ -Simple1.prototype.setABoolean = function(value) { - return jspb.Message.setField(this, 3, value); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Simple1} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new Simple1; + return Simple1.deserializeBinaryFromReader(msg, reader); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.Simple1} returns this - */ -Simple1.prototype.clearABoolean = function() { - return jspb.Message.setField(this, 3, undefined); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Simple1} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Simple1} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + case 3: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setABoolean(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -Simple1.prototype.hasABoolean = function() { - return jspb.Message.getField(this, 3) != null; -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + Simple1.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Simple1} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeBool( + 3, + f + ); + } + }; + -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -Simple2.repeatedFields_ = [2]; +} @@ -1437,8 +533,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -Simple2.prototype.toObject = function(opt_includeInstance) { - return Simple2.toObject(opt_includeInstance, this); +Simple1.prototype.toObject = function(opt_includeInstance) { + return Simple1.toObject(opt_includeInstance, this); }; @@ -1447,14 +543,15 @@ Simple2.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Simple2} msg The msg instance to transform. + * @param {!proto.jspb.test.Simple1} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -Simple2.toObject = function(includeInstance, msg) { +Simple1.toObject = function(includeInstance, msg) { var f, obj = { aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, -aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f, +aBoolean: (f = jspb.Message.getBooleanField(msg, 3)) == null ? undefined : f }; if (includeInstance) { @@ -1465,159 +562,181 @@ aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undef } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Simple2} - */ -Simple2.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new Simple2; - return Simple2.deserializeBinaryFromReader(msg, reader); -}; +export class Simple2 extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, Simple2.repeatedFields_, null); + }; + /** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ + static repeatedFields_ = [2]; + /** + * required string a_string = 1; + * @return {string} + */ + getAString() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.Simple2} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Simple2} - */ -Simple2.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setAString(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.addARepeatedString(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * @param {string} value + * @return {!proto.jspb.test.Simple2} returns this + */ + setAString(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -Simple2.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - Simple2.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Simple2} returns this + */ + clearAString() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Simple2} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -Simple2.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeString( - 1, - f - ); - } - f = message.getARepeatedStringList(); - if (f.length > 0) { - writer.writeRepeatedString( - 2, - f - ); - } -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasAString() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * required string a_string = 1; - * @return {string} - */ -Simple2.prototype.getAString = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; + /** + * repeated string a_repeated_string = 2; + * @return {!Array} + */ + getARepeatedStringList() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.Simple2} returns this - */ -Simple2.prototype.setAString = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.Simple2} returns this + */ + setARepeatedStringList(value) { + return jspb.Message.setField(this, 2, value || []); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.Simple2} returns this - */ -Simple2.prototype.clearAString = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.Simple2} returns this + */ + addARepeatedString(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 2, value, opt_index); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -Simple2.prototype.hasAString = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Simple2} returns this + */ + clearARepeatedStringList() { + return this.setARepeatedStringList([]); + }; -/** - * repeated string a_repeated_string = 2; - * @return {!Array} - */ -Simple2.prototype.getARepeatedStringList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 2)); -}; + + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Simple2} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new Simple2; + return Simple2.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {!Array} value - * @return {!proto.jspb.test.Simple2} returns this - */ -Simple2.prototype.setARepeatedStringList = function(value) { - return jspb.Message.setField(this, 2, value || []); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Simple2} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Simple2} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.jspb.test.Simple2} returns this - */ -Simple2.prototype.addARepeatedString = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 2, value, opt_index); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + Simple2.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.Simple2} returns this - */ -Simple2.prototype.clearARepeatedStringList = function() { - return this.setARepeatedStringList([]); -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Simple2} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 2, + f + ); + } + }; +} @@ -1634,8 +753,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -SpecialCases.prototype.toObject = function(opt_includeInstance) { - return SpecialCases.toObject(opt_includeInstance, this); +Simple2.prototype.toObject = function(opt_includeInstance) { + return Simple2.toObject(opt_includeInstance, this); }; @@ -1644,16 +763,14 @@ SpecialCases.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.SpecialCases} msg The msg instance to transform. + * @param {!proto.jspb.test.Simple2} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -SpecialCases.toObject = function(includeInstance, msg) { +Simple2.toObject = function(includeInstance, msg) { var f, obj = { -normal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, -pb_default: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, -pb_function: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, -pb_var: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 2)) == null ? undefined : f }; if (includeInstance) { @@ -1664,259 +781,267 @@ pb_var: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.SpecialCases} - */ -SpecialCases.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new SpecialCases; - return SpecialCases.deserializeBinaryFromReader(msg, reader); -}; - +export class SpecialCases extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * required string normal = 1; + * @return {string} + */ + getNormal() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.SpecialCases} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.SpecialCases} - */ -SpecialCases.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setNormal(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setDefault(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setFunction(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.setVar(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ + setNormal(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -SpecialCases.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - SpecialCases.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ + clearNormal() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.SpecialCases} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -SpecialCases.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeString( - 1, - f - ); - } - f = /** @type {string} */ (jspb.Message.getField(message, 2)); - if (f != null) { - writer.writeString( - 2, - f - ); - } - f = /** @type {string} */ (jspb.Message.getField(message, 3)); - if (f != null) { - writer.writeString( - 3, - f - ); - } - f = /** @type {string} */ (jspb.Message.getField(message, 4)); - if (f != null) { - writer.writeString( - 4, - f - ); - } -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasNormal() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * required string normal = 1; - * @return {string} - */ -SpecialCases.prototype.getNormal = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; + /** + * required string default = 2; + * @return {string} + */ + getDefault() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.SpecialCases} returns this - */ -SpecialCases.prototype.setNormal = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ + setDefault(value) { + return jspb.Message.setField(this, 2, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.SpecialCases} returns this - */ -SpecialCases.prototype.clearNormal = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ + clearDefault() { + return jspb.Message.setField(this, 2, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -SpecialCases.prototype.hasNormal = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasDefault() { + return jspb.Message.getField(this, 2) != null; + }; -/** - * required string default = 2; - * @return {string} - */ -SpecialCases.prototype.getDefault = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; + /** + * required string function = 3; + * @return {string} + */ + getFunction() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.SpecialCases} returns this - */ -SpecialCases.prototype.setDefault = function(value) { - return jspb.Message.setField(this, 2, value); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ + setFunction(value) { + return jspb.Message.setField(this, 3, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.SpecialCases} returns this - */ -SpecialCases.prototype.clearDefault = function() { - return jspb.Message.setField(this, 2, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ + clearFunction() { + return jspb.Message.setField(this, 3, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -SpecialCases.prototype.hasDefault = function() { - return jspb.Message.getField(this, 2) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasFunction() { + return jspb.Message.getField(this, 3) != null; + }; -/** - * required string function = 3; - * @return {string} - */ -SpecialCases.prototype.getFunction = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; + /** + * required string var = 4; + * @return {string} + */ + getVar() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.SpecialCases} returns this - */ -SpecialCases.prototype.setFunction = function(value) { - return jspb.Message.setField(this, 3, value); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.SpecialCases} returns this + */ + setVar(value) { + return jspb.Message.setField(this, 4, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.SpecialCases} returns this - */ -SpecialCases.prototype.clearFunction = function() { - return jspb.Message.setField(this, 3, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.SpecialCases} returns this + */ + clearVar() { + return jspb.Message.setField(this, 4, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -SpecialCases.prototype.hasFunction = function() { - return jspb.Message.getField(this, 3) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasVar() { + return jspb.Message.getField(this, 4) != null; + }; -/** - * required string var = 4; - * @return {string} - */ -SpecialCases.prototype.getVar = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.SpecialCases} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new SpecialCases; + return SpecialCases.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.SpecialCases} returns this - */ -SpecialCases.prototype.setVar = function(value) { - return jspb.Message.setField(this, 4, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.SpecialCases} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.SpecialCases} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setNormal(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setDefault(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setFunction(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setVar(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.SpecialCases} returns this - */ -SpecialCases.prototype.clearVar = function() { - return jspb.Message.setField(this, 4, undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + SpecialCases.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -SpecialCases.prototype.hasVar = function() { - return jspb.Message.getField(this, 4) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.SpecialCases} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeString( + 4, + f + ); + } + }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -OptionalFields.repeatedFields_ = [4,5]; +} @@ -1933,8 +1058,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -OptionalFields.prototype.toObject = function(opt_includeInstance) { - return OptionalFields.toObject(opt_includeInstance, this); +SpecialCases.prototype.toObject = function(opt_includeInstance) { + return SpecialCases.toObject(opt_includeInstance, this); }; @@ -1943,18 +1068,16 @@ OptionalFields.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.OptionalFields} msg The msg instance to transform. + * @param {!proto.jspb.test.SpecialCases} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -OptionalFields.toObject = function(includeInstance, msg) { +SpecialCases.toObject = function(includeInstance, msg) { var f, obj = { -aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, -aBool: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, -aNestedMessage: (f = msg.getANestedMessage()) && OptionalFields.Nested.toObject(includeInstance, f), -aRepeatedMessageList: jspb.Message.toObjectList(msg.getARepeatedMessageList(), - OptionalFields.Nested.toObject, includeInstance), -aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f +normal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +pb_default: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, +pb_function: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, +pb_var: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f }; if (includeInstance) { @@ -1965,455 +1088,497 @@ aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undef } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.OptionalFields} - */ -OptionalFields.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new OptionalFields; - return OptionalFields.deserializeBinaryFromReader(msg, reader); -}; +export class OptionalFields extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, OptionalFields.repeatedFields_, null); + }; + /** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ + static repeatedFields_ = [4,5]; + /** + * optional string a_string = 1; + * @return {string} + */ + getAString() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.OptionalFields} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.OptionalFields} - */ -OptionalFields.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setAString(value); - break; - case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setABool(value); - break; - case 3: - var value = new OptionalFields.Nested; - reader.readMessage(value,OptionalFields.Nested.deserializeBinaryFromReader); - msg.setANestedMessage(value); - break; - case 4: - var value = new OptionalFields.Nested; - reader.readMessage(value,OptionalFields.Nested.deserializeBinaryFromReader); - msg.addARepeatedMessage(value); - break; - case 5: - var value = /** @type {string} */ (reader.readString()); - msg.addARepeatedString(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * @param {string} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ + setAString(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -OptionalFields.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - OptionalFields.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OptionalFields} returns this + */ + clearAString() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.OptionalFields} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -OptionalFields.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeString( - 1, - f - ); - } - f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); - if (f != null) { - writer.writeBool( - 2, - f - ); - } - f = message.getANestedMessage(); - if (f != null) { - writer.writeMessage( - 3, - f, - OptionalFields.Nested.serializeBinaryToWriter - ); - } - f = message.getARepeatedMessageList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 4, - f, - OptionalFields.Nested.serializeBinaryToWriter - ); - } - f = message.getARepeatedStringList(); - if (f.length > 0) { - writer.writeRepeatedString( - 5, - f - ); - } -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasAString() { + return jspb.Message.getField(this, 1) != null; + }; + /** + * required bool a_bool = 2; + * @return {boolean} + */ + getABool() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); + }; -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -OptionalFields.Nested.prototype.toObject = function(opt_includeInstance) { - return OptionalFields.Nested.toObject(opt_includeInstance, this); -}; + /** + * @param {boolean} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ + setABool(value) { + return jspb.Message.setField(this, 2, value); + }; -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.jspb.test.OptionalFields.Nested} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -OptionalFields.Nested.toObject = function(includeInstance, msg) { - var f, obj = { -anInt: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OptionalFields} returns this + */ + clearABool() { + return jspb.Message.setField(this, 2, undefined); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.OptionalFields.Nested} - */ -OptionalFields.Nested.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new OptionalFields.Nested; - return OptionalFields.Nested.deserializeBinaryFromReader(msg, reader); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasABool() { + return jspb.Message.getField(this, 2) != null; + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.OptionalFields.Nested} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.OptionalFields.Nested} - */ -OptionalFields.Nested.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setAnInt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * optional Nested a_nested_message = 3; + * @return {?proto.jspb.test.OptionalFields.Nested} + */ + getANestedMessage() { + return /** @type{?proto.jspb.test.OptionalFields.Nested} */ ( + jspb.Message.getWrapperField(this, OptionalFields.Nested, 3)); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -OptionalFields.Nested.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - OptionalFields.Nested.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * @param {?proto.jspb.test.OptionalFields.Nested|undefined} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ + setANestedMessage(value) { + return jspb.Message.setWrapperField(this, 3, value); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.OptionalFields.Nested} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -OptionalFields.Nested.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeInt32( - 1, - f - ); - } -}; + /** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.OptionalFields} returns this + */ + clearANestedMessage() { + return this.setANestedMessage(undefined); + }; -/** - * optional int32 an_int = 1; - * @return {number} - */ -OptionalFields.Nested.prototype.getAnInt = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasANestedMessage() { + return jspb.Message.getField(this, 3) != null; + }; -/** - * @param {number} value - * @return {!proto.jspb.test.OptionalFields.Nested} returns this - */ -OptionalFields.Nested.prototype.setAnInt = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * repeated Nested a_repeated_message = 4; + * @return {!Array} + */ + getARepeatedMessageList() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, OptionalFields.Nested, 4)); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.OptionalFields.Nested} returns this - */ -OptionalFields.Nested.prototype.clearAnInt = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ + setARepeatedMessageList(value) { + return jspb.Message.setRepeatedWrapperField(this, 4, value); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -OptionalFields.Nested.prototype.hasAnInt = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * @param {!proto.jspb.test.OptionalFields.Nested=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.OptionalFields.Nested} + */ + addARepeatedMessage(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, OptionalFields.Nested, opt_index); + }; -/** - * optional string a_string = 1; - * @return {string} - */ -OptionalFields.prototype.getAString = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.OptionalFields} returns this + */ + clearARepeatedMessageList() { + return this.setARepeatedMessageList([]); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.OptionalFields} returns this - */ -OptionalFields.prototype.setAString = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * repeated string a_repeated_string = 5; + * @return {!Array} + */ + getARepeatedStringList() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.OptionalFields} returns this - */ -OptionalFields.prototype.clearAString = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.OptionalFields} returns this + */ + setARepeatedStringList(value) { + return jspb.Message.setField(this, 5, value || []); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -OptionalFields.prototype.hasAString = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.OptionalFields} returns this + */ + addARepeatedString(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 5, value, opt_index); + }; -/** - * required bool a_bool = 2; - * @return {boolean} - */ -OptionalFields.prototype.getABool = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.OptionalFields} returns this + */ + clearARepeatedStringList() { + return this.setARepeatedStringList([]); + }; -/** - * @param {boolean} value - * @return {!proto.jspb.test.OptionalFields} returns this - */ -OptionalFields.prototype.setABool = function(value) { - return jspb.Message.setField(this, 2, value); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OptionalFields} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new OptionalFields; + return OptionalFields.deserializeBinaryFromReader(msg, reader); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.OptionalFields} returns this - */ -OptionalFields.prototype.clearABool = function() { - return jspb.Message.setField(this, 2, undefined); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OptionalFields} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OptionalFields} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setABool(value); + break; + case 3: + var value = new OptionalFields.Nested; + reader.readMessage(value,OptionalFields.Nested.deserializeBinaryFromReader); + msg.setANestedMessage(value); + break; + case 4: + var value = new OptionalFields.Nested; + reader.readMessage(value,OptionalFields.Nested.deserializeBinaryFromReader); + msg.addARepeatedMessage(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -OptionalFields.prototype.hasABool = function() { - return jspb.Message.getField(this, 2) != null; -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + OptionalFields.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * optional Nested a_nested_message = 3; - * @return {?proto.jspb.test.OptionalFields.Nested} - */ -OptionalFields.prototype.getANestedMessage = function() { - return /** @type{?proto.jspb.test.OptionalFields.Nested} */ ( - jspb.Message.getWrapperField(this, OptionalFields.Nested, 3)); -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OptionalFields} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = message.getANestedMessage(); + if (f != null) { + writer.writeMessage( + 3, + f, + OptionalFields.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedMessageList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 4, + f, + OptionalFields.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 5, + f + ); + } + }; -/** - * @param {?proto.jspb.test.OptionalFields.Nested|undefined} value - * @return {!proto.jspb.test.OptionalFields} returns this -*/ -OptionalFields.prototype.setANestedMessage = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; +} + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Clears the message field making it undefined. - * @return {!proto.jspb.test.OptionalFields} returns this + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -OptionalFields.prototype.clearANestedMessage = function() { - return this.setANestedMessage(undefined); +OptionalFields.prototype.toObject = function(opt_includeInstance) { + return OptionalFields.toObject(opt_includeInstance, this); }; /** - * Returns whether this field is set. - * @return {boolean} + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.OptionalFields} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -OptionalFields.prototype.hasANestedMessage = function() { - return jspb.Message.getField(this, 3) != null; +OptionalFields.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +aBool: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, +aNestedMessage: (f = msg.getANestedMessage()) && OptionalFields.Nested.toObject(includeInstance, f), +aRepeatedMessageList: jspb.Message.toObjectList(msg.getARepeatedMessageList(), + OptionalFields.Nested.toObject, includeInstance), +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} -/** - * repeated Nested a_repeated_message = 4; - * @return {!Array} - */ -OptionalFields.prototype.getARepeatedMessageList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, OptionalFields.Nested, 4)); -}; +OptionalFields.Nested = class extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * optional int32 an_int = 1; + * @return {number} + */ + getAnInt() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); + }; -/** - * @param {!Array} value - * @return {!proto.jspb.test.OptionalFields} returns this -*/ -OptionalFields.prototype.setARepeatedMessageList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 4, value); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.OptionalFields.Nested} returns this + */ + setAnInt(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * @param {!proto.jspb.test.OptionalFields.Nested=} opt_value - * @param {number=} opt_index - * @return {!proto.jspb.test.OptionalFields.Nested} - */ -OptionalFields.prototype.addARepeatedMessage = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, OptionalFields.Nested, opt_index); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OptionalFields.Nested} returns this + */ + clearAnInt() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.OptionalFields} returns this - */ -OptionalFields.prototype.clearARepeatedMessageList = function() { - return this.setARepeatedMessageList([]); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasAnInt() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * repeated string a_repeated_string = 5; - * @return {!Array} - */ -OptionalFields.prototype.getARepeatedStringList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 5)); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OptionalFields.Nested} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new OptionalFields.Nested; + return OptionalFields.Nested.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {!Array} value - * @return {!proto.jspb.test.OptionalFields} returns this - */ -OptionalFields.prototype.setARepeatedStringList = function(value) { - return jspb.Message.setField(this, 5, value || []); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OptionalFields.Nested} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OptionalFields.Nested} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAnInt(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.jspb.test.OptionalFields} returns this - */ -OptionalFields.prototype.addARepeatedString = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 5, value, opt_index); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + OptionalFields.Nested.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.OptionalFields} returns this - */ -OptionalFields.prototype.clearARepeatedStringList = function() { - return this.setARepeatedStringList([]); -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OptionalFields.Nested} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + }; +} @@ -2430,8 +1595,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -HasExtensions.prototype.toObject = function(opt_includeInstance) { - return HasExtensions.toObject(opt_includeInstance, this); +OptionalFields.Nested.prototype.toObject = function(opt_includeInstance) { + return OptionalFields.Nested.toObject(opt_includeInstance, this); }; @@ -2440,20 +1605,15 @@ HasExtensions.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.HasExtensions} msg The msg instance to transform. + * @param {!proto.jspb.test.OptionalFields.Nested} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -HasExtensions.toObject = function(includeInstance, msg) { +OptionalFields.Nested.toObject = function(includeInstance, msg) { var f, obj = { -str1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, -str2: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, -str3: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f +anInt: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; - jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, - HasExtensions.extensions, HasExtensions.prototype.getExtension, - includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; } @@ -2462,217 +1622,255 @@ str3: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.HasExtensions} - */ -HasExtensions.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new HasExtensions; - return HasExtensions.deserializeBinaryFromReader(msg, reader); -}; +export class HasExtensions extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 4, null, null); + }; + /** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ + static extensions = {}; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.HasExtensions} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.HasExtensions} - */ -HasExtensions.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setStr1(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setStr2(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setStr3(value); - break; - default: - jspb.Message.readBinaryExtension(msg, reader, - HasExtensions.extensionsBinary, - HasExtensions.prototype.getExtension, - HasExtensions.prototype.setExtension); - break; - } - } - return msg; -}; + /** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ + static extensionsBinary = {}; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -HasExtensions.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - HasExtensions.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * optional string str1 = 1; + * @return {string} + */ + getStr1() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.HasExtensions} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -HasExtensions.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeString( - 1, - f - ); - } - f = /** @type {string} */ (jspb.Message.getField(message, 2)); - if (f != null) { - writer.writeString( - 2, - f - ); - } - f = /** @type {string} */ (jspb.Message.getField(message, 3)); - if (f != null) { - writer.writeString( - 3, - f - ); - } - jspb.Message.serializeBinaryExtensions(message, writer, - HasExtensions.extensionsBinary, HasExtensions.prototype.getExtension); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.HasExtensions} returns this + */ + setStr1(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * optional string str1 = 1; - * @return {string} - */ -HasExtensions.prototype.getStr1 = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.HasExtensions} returns this + */ + clearStr1() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.HasExtensions} returns this - */ -HasExtensions.prototype.setStr1 = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasStr1() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.HasExtensions} returns this - */ -HasExtensions.prototype.clearStr1 = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * optional string str2 = 2; + * @return {string} + */ + getStr2() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -HasExtensions.prototype.hasStr1 = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * @param {string} value + * @return {!proto.jspb.test.HasExtensions} returns this + */ + setStr2(value) { + return jspb.Message.setField(this, 2, value); + }; -/** - * optional string str2 = 2; - * @return {string} - */ -HasExtensions.prototype.getStr2 = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.HasExtensions} returns this + */ + clearStr2() { + return jspb.Message.setField(this, 2, undefined); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.HasExtensions} returns this - */ -HasExtensions.prototype.setStr2 = function(value) { - return jspb.Message.setField(this, 2, value); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasStr2() { + return jspb.Message.getField(this, 2) != null; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.HasExtensions} returns this - */ -HasExtensions.prototype.clearStr2 = function() { - return jspb.Message.setField(this, 2, undefined); -}; + /** + * optional string str3 = 3; + * @return {string} + */ + getStr3() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -HasExtensions.prototype.hasStr2 = function() { - return jspb.Message.getField(this, 2) != null; -}; + /** + * @param {string} value + * @return {!proto.jspb.test.HasExtensions} returns this + */ + setStr3(value) { + return jspb.Message.setField(this, 3, value); + }; -/** - * optional string str3 = 3; - * @return {string} - */ -HasExtensions.prototype.getStr3 = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.HasExtensions} returns this + */ + clearStr3() { + return jspb.Message.setField(this, 3, undefined); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.HasExtensions} returns this - */ -HasExtensions.prototype.setStr3 = function(value) { - return jspb.Message.setField(this, 3, value); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasStr3() { + return jspb.Message.getField(this, 3) != null; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.HasExtensions} returns this - */ -HasExtensions.prototype.clearStr3 = function() { - return jspb.Message.setField(this, 3, undefined); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.HasExtensions} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new HasExtensions; + return HasExtensions.deserializeBinaryFromReader(msg, reader); + }; + + + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.HasExtensions} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.HasExtensions} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStr1(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setStr2(value); + break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setStr3(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + HasExtensions.extensionsBinary, + HasExtensions.prototype.getExtension, + HasExtensions.prototype.setExtension); + break; + } + } + return msg; + }; + + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + HasExtensions.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -HasExtensions.prototype.hasStr3 = function() { - return jspb.Message.getField(this, 3) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.HasExtensions} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + HasExtensions.extensionsBinary, HasExtensions.prototype.getExtension); + }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -Complex.repeatedFields_ = [5,7]; +} @@ -2689,8 +1887,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -Complex.prototype.toObject = function(opt_includeInstance) { - return Complex.toObject(opt_includeInstance, this); +HasExtensions.prototype.toObject = function(opt_includeInstance) { + return HasExtensions.toObject(opt_includeInstance, this); }; @@ -2699,21 +1897,20 @@ Complex.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Complex} msg The msg instance to transform. + * @param {!proto.jspb.test.HasExtensions} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -Complex.toObject = function(includeInstance, msg) { +HasExtensions.toObject = function(includeInstance, msg) { var f, obj = { -aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, -anOutOfOrderBool: (f = jspb.Message.getBooleanField(msg, 9)) == null ? undefined : f, -aNestedMessage: (f = msg.getANestedMessage()) && Complex.Nested.toObject(includeInstance, f), -aRepeatedMessageList: jspb.Message.toObjectList(msg.getARepeatedMessageList(), - Complex.Nested.toObject, includeInstance), -aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 7)) == null ? undefined : f, -aFloatingPointField: (f = jspb.Message.getOptionalFloatingPointField(msg, 10)) == null ? undefined : f +str1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +str2: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, +str3: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f }; + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + HasExtensions.extensions, HasExtensions.prototype.getExtension, + includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; } @@ -2722,502 +1919,661 @@ aFloatingPointField: (f = jspb.Message.getOptionalFloatingPointField(msg, 10)) = } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Complex} - */ -Complex.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new Complex; - return Complex.deserializeBinaryFromReader(msg, reader); -}; +export class Complex extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, Complex.repeatedFields_, null); + }; + /** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ + static repeatedFields_ = [5,7]; + /** + * required string a_string = 1; + * @return {string} + */ + getAString() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.Complex} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Complex} - */ -Complex.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setAString(value); - break; - case 9: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setAnOutOfOrderBool(value); - break; - case 4: - var value = new Complex.Nested; - reader.readMessage(value,Complex.Nested.deserializeBinaryFromReader); - msg.setANestedMessage(value); - break; - case 5: - var value = new Complex.Nested; - reader.readMessage(value,Complex.Nested.deserializeBinaryFromReader); - msg.addARepeatedMessage(value); - break; - case 7: - var value = /** @type {string} */ (reader.readString()); - msg.addARepeatedString(value); - break; - case 10: - var value = /** @type {number} */ (reader.readDouble()); - msg.setAFloatingPointField(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * @param {string} value + * @return {!proto.jspb.test.Complex} returns this + */ + setAString(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -Complex.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - Complex.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ + clearAString() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Complex} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -Complex.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeString( - 1, - f - ); - } - f = /** @type {boolean} */ (jspb.Message.getField(message, 9)); - if (f != null) { - writer.writeBool( - 9, - f - ); - } - f = message.getANestedMessage(); - if (f != null) { - writer.writeMessage( - 4, - f, - Complex.Nested.serializeBinaryToWriter - ); - } - f = message.getARepeatedMessageList(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 5, - f, - Complex.Nested.serializeBinaryToWriter - ); - } - f = message.getARepeatedStringList(); - if (f.length > 0) { - writer.writeRepeatedString( - 7, - f - ); - } - f = /** @type {number} */ (jspb.Message.getField(message, 10)); - if (f != null) { - writer.writeDouble( - 10, - f - ); - } -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasAString() { + return jspb.Message.getField(this, 1) != null; + }; + /** + * optional bool an_out_of_order_bool = 9; + * @return {boolean} + */ + getAnOutOfOrderBool() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false)); + }; -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -Complex.Nested.prototype.toObject = function(opt_includeInstance) { - return Complex.Nested.toObject(opt_includeInstance, this); -}; + /** + * @param {boolean} value + * @return {!proto.jspb.test.Complex} returns this + */ + setAnOutOfOrderBool(value) { + return jspb.Message.setField(this, 9, value); + }; -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.jspb.test.Complex.Nested} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -Complex.Nested.toObject = function(includeInstance, msg) { - var f, obj = { -anInt: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ + clearAnOutOfOrderBool() { + return jspb.Message.setField(this, 9, undefined); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasAnOutOfOrderBool() { + return jspb.Message.getField(this, 9) != null; + }; -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Complex.Nested} - */ -Complex.Nested.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new Complex.Nested; - return Complex.Nested.deserializeBinaryFromReader(msg, reader); -}; + /** + * optional Nested a_nested_message = 4; + * @return {?proto.jspb.test.Complex.Nested} + */ + getANestedMessage() { + return /** @type{?proto.jspb.test.Complex.Nested} */ ( + jspb.Message.getWrapperField(this, Complex.Nested, 4)); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.Complex.Nested} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Complex.Nested} - */ -Complex.Nested.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 2: - var value = /** @type {number} */ (reader.readInt32()); - msg.setAnInt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * @param {?proto.jspb.test.Complex.Nested|undefined} value + * @return {!proto.jspb.test.Complex} returns this + */ + setANestedMessage(value) { + return jspb.Message.setWrapperField(this, 4, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -Complex.Nested.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - Complex.Nested.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + + /** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ + clearANestedMessage() { + return this.setANestedMessage(undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Complex.Nested} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -Complex.Nested.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 2)); - if (f != null) { - writer.writeInt32( - 2, - f - ); - } -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasANestedMessage() { + return jspb.Message.getField(this, 4) != null; + }; -/** - * required int32 an_int = 2; - * @return {number} - */ -Complex.Nested.prototype.getAnInt = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); -}; + /** + * repeated Nested a_repeated_message = 5; + * @return {!Array} + */ + getARepeatedMessageList() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, Complex.Nested, 5)); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.Complex.Nested} returns this - */ -Complex.Nested.prototype.setAnInt = function(value) { - return jspb.Message.setField(this, 2, value); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.Complex} returns this + */ + setARepeatedMessageList(value) { + return jspb.Message.setRepeatedWrapperField(this, 5, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.Complex.Nested} returns this - */ -Complex.Nested.prototype.clearAnInt = function() { - return jspb.Message.setField(this, 2, undefined); -}; + /** + * @param {!proto.jspb.test.Complex.Nested=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.Complex.Nested} + */ + addARepeatedMessage(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, Complex.Nested, opt_index); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -Complex.Nested.prototype.hasAnInt = function() { - return jspb.Message.getField(this, 2) != null; -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Complex} returns this + */ + clearARepeatedMessageList() { + return this.setARepeatedMessageList([]); + }; -/** - * required string a_string = 1; - * @return {string} - */ -Complex.prototype.getAString = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; + /** + * repeated string a_repeated_string = 7; + * @return {!Array} + */ + getARepeatedStringList() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 7)); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.Complex} returns this - */ -Complex.prototype.setAString = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.Complex} returns this + */ + setARepeatedStringList(value) { + return jspb.Message.setField(this, 7, value || []); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.Complex} returns this - */ -Complex.prototype.clearAString = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.Complex} returns this + */ + addARepeatedString(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 7, value, opt_index); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -Complex.prototype.hasAString = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.Complex} returns this + */ + clearARepeatedStringList() { + return this.setARepeatedStringList([]); + }; -/** - * optional bool an_out_of_order_bool = 9; - * @return {boolean} - */ -Complex.prototype.getAnOutOfOrderBool = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false)); -}; + /** + * optional double a_floating_point_field = 10; + * @return {number} + */ + getAFloatingPointField() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 10, 0.0)); + }; + + + /** + * @param {number} value + * @return {!proto.jspb.test.Complex} returns this + */ + setAFloatingPointField(value) { + return jspb.Message.setField(this, 10, value); + }; + + + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex} returns this + */ + clearAFloatingPointField() { + return jspb.Message.setField(this, 10, undefined); + }; + + + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasAFloatingPointField() { + return jspb.Message.getField(this, 10) != null; + }; + + + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Complex} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new Complex; + return Complex.deserializeBinaryFromReader(msg, reader); + }; + + + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Complex} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Complex} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setAString(value); + break; + case 9: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setAnOutOfOrderBool(value); + break; + case 4: + var value = new Complex.Nested; + reader.readMessage(value,Complex.Nested.deserializeBinaryFromReader); + msg.setANestedMessage(value); + break; + case 5: + var value = new Complex.Nested; + reader.readMessage(value,Complex.Nested.deserializeBinaryFromReader); + msg.addARepeatedMessage(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.addARepeatedString(value); + break; + case 10: + var value = /** @type {number} */ (reader.readDouble()); + msg.setAFloatingPointField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; + + + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + Complex.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; + + + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Complex} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 9)); + if (f != null) { + writer.writeBool( + 9, + f + ); + } + f = message.getANestedMessage(); + if (f != null) { + writer.writeMessage( + 4, + f, + Complex.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedMessageList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + Complex.Nested.serializeBinaryToWriter + ); + } + f = message.getARepeatedStringList(); + if (f.length > 0) { + writer.writeRepeatedString( + 7, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeDouble( + 10, + f + ); + } + }; + + +} + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * @param {boolean} value - * @return {!proto.jspb.test.Complex} returns this + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -Complex.prototype.setAnOutOfOrderBool = function(value) { - return jspb.Message.setField(this, 9, value); +Complex.prototype.toObject = function(opt_includeInstance) { + return Complex.toObject(opt_includeInstance, this); }; /** - * Clears the field making it undefined. - * @return {!proto.jspb.test.Complex} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Complex} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -Complex.prototype.clearAnOutOfOrderBool = function() { - return jspb.Message.setField(this, 9, undefined); -}; - +Complex.toObject = function(includeInstance, msg) { + var f, obj = { +aString: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +anOutOfOrderBool: (f = jspb.Message.getBooleanField(msg, 9)) == null ? undefined : f, +aNestedMessage: (f = msg.getANestedMessage()) && Complex.Nested.toObject(includeInstance, f), +aRepeatedMessageList: jspb.Message.toObjectList(msg.getARepeatedMessageList(), + Complex.Nested.toObject, includeInstance), +aRepeatedStringList: (f = jspb.Message.getRepeatedField(msg, 7)) == null ? undefined : f, +aFloatingPointField: (f = jspb.Message.getOptionalFloatingPointField(msg, 10)) == null ? undefined : f + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -Complex.prototype.hasAnOutOfOrderBool = function() { - return jspb.Message.getField(this, 9) != null; + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} -/** - * optional Nested a_nested_message = 4; - * @return {?proto.jspb.test.Complex.Nested} - */ -Complex.prototype.getANestedMessage = function() { - return /** @type{?proto.jspb.test.Complex.Nested} */ ( - jspb.Message.getWrapperField(this, Complex.Nested, 4)); -}; - +Complex.Nested = class extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * required int32 an_int = 2; + * @return {number} + */ + getAnInt() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0)); + }; -/** - * @param {?proto.jspb.test.Complex.Nested|undefined} value - * @return {!proto.jspb.test.Complex} returns this -*/ -Complex.prototype.setANestedMessage = function(value) { - return jspb.Message.setWrapperField(this, 4, value); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.Complex.Nested} returns this + */ + setAnInt(value) { + return jspb.Message.setField(this, 2, value); + }; -/** - * Clears the message field making it undefined. - * @return {!proto.jspb.test.Complex} returns this - */ -Complex.prototype.clearANestedMessage = function() { - return this.setANestedMessage(undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Complex.Nested} returns this + */ + clearAnInt() { + return jspb.Message.setField(this, 2, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -Complex.prototype.hasANestedMessage = function() { - return jspb.Message.getField(this, 4) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasAnInt() { + return jspb.Message.getField(this, 2) != null; + }; -/** - * repeated Nested a_repeated_message = 5; - * @return {!Array} - */ -Complex.prototype.getARepeatedMessageList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, Complex.Nested, 5)); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Complex.Nested} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new Complex.Nested; + return Complex.Nested.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {!Array} value - * @return {!proto.jspb.test.Complex} returns this -*/ -Complex.prototype.setARepeatedMessageList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 5, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Complex.Nested} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Complex.Nested} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 2: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAnInt(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * @param {!proto.jspb.test.Complex.Nested=} opt_value - * @param {number=} opt_index - * @return {!proto.jspb.test.Complex.Nested} - */ -Complex.prototype.addARepeatedMessage = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, Complex.Nested, opt_index); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + Complex.Nested.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.Complex} returns this - */ -Complex.prototype.clearARepeatedMessageList = function() { - return this.setARepeatedMessageList([]); -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Complex.Nested} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeInt32( + 2, + f + ); + } + }; -/** - * repeated string a_repeated_string = 7; - * @return {!Array} - */ -Complex.prototype.getARepeatedStringList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 7)); -}; +} -/** - * @param {!Array} value - * @return {!proto.jspb.test.Complex} returns this - */ -Complex.prototype.setARepeatedStringList = function(value) { - return jspb.Message.setField(this, 7, value || []); -}; +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.jspb.test.Complex} returns this + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -Complex.prototype.addARepeatedString = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 7, value, opt_index); +Complex.Nested.prototype.toObject = function(opt_includeInstance) { + return Complex.Nested.toObject(opt_includeInstance, this); }; /** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.Complex} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.Complex.Nested} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -Complex.prototype.clearARepeatedStringList = function() { - return this.setARepeatedStringList([]); +Complex.Nested.toObject = function(includeInstance, msg) { + var f, obj = { +anInt: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} -/** - * optional double a_floating_point_field = 10; - * @return {number} - */ -Complex.prototype.getAFloatingPointField = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 10, 0.0)); -}; +export class OuterMessage extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OuterMessage} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new OuterMessage; + return OuterMessage.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.Complex} returns this - */ -Complex.prototype.setAFloatingPointField = function(value) { - return jspb.Message.setField(this, 10, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OuterMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OuterMessage} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.Complex} returns this - */ -Complex.prototype.clearAFloatingPointField = function() { - return jspb.Message.setField(this, 10, undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + OuterMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -Complex.prototype.hasAFloatingPointField = function() { - return jspb.Message.getField(this, 10) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OuterMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + }; +} @@ -3261,64 +2617,126 @@ OuterMessage.toObject = function(includeInstance, msg) { } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.OuterMessage} - */ -OuterMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new OuterMessage; - return OuterMessage.deserializeBinaryFromReader(msg, reader); -}; +OuterMessage.Complex = class extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * optional int32 inner_complex_field = 1; + * @return {number} + */ + getInnerComplexField() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.OuterMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.OuterMessage} - */ -OuterMessage.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; + /** + * @param {number} value + * @return {!proto.jspb.test.OuterMessage.Complex} returns this + */ + setInnerComplexField(value) { + return jspb.Message.setField(this, 1, value); + }; + + + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.OuterMessage.Complex} returns this + */ + clearInnerComplexField() { + return jspb.Message.setField(this, 1, undefined); + }; + + + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasInnerComplexField() { + return jspb.Message.getField(this, 1) != null; + }; + + + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.OuterMessage.Complex} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new OuterMessage.Complex; + return OuterMessage.Complex.deserializeBinaryFromReader(msg, reader); + }; + + + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.OuterMessage.Complex} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.OuterMessage.Complex} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setInnerComplexField(value); + break; + default: + reader.skipField(); + break; + } } - } - return msg; -}; + return msg; + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -OuterMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - OuterMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + OuterMessage.Complex.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.OuterMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -OuterMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.OuterMessage.Complex} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + }; +} @@ -3362,111 +2780,126 @@ innerComplexField: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.OuterMessage.Complex} - */ -OuterMessage.Complex.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new OuterMessage.Complex; - return OuterMessage.Complex.deserializeBinaryFromReader(msg, reader); -}; +export class MineField extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * optional string cookie = 1; + * @return {string} + */ + getCookie() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.OuterMessage.Complex} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.OuterMessage.Complex} - */ -OuterMessage.Complex.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setInnerComplexField(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * @param {string} value + * @return {!proto.jspb.test.MineField} returns this + */ + setCookie(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -OuterMessage.Complex.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - OuterMessage.Complex.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.MineField} returns this + */ + clearCookie() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.OuterMessage.Complex} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -OuterMessage.Complex.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeInt32( - 1, - f - ); - } -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasCookie() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * optional int32 inner_complex_field = 1; - * @return {number} - */ -OuterMessage.Complex.prototype.getInnerComplexField = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.MineField} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new MineField; + return MineField.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.OuterMessage.Complex} returns this - */ -OuterMessage.Complex.prototype.setInnerComplexField = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.MineField} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.MineField} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setCookie(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.OuterMessage.Complex} returns this - */ -OuterMessage.Complex.prototype.clearInnerComplexField = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + MineField.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -OuterMessage.Complex.prototype.hasInnerComplexField = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.MineField} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + }; +} @@ -3510,111 +2943,139 @@ cookie: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.MineField} - */ -MineField.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new MineField; - return MineField.deserializeBinaryFromReader(msg, reader); -}; +export class IsExtension extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ + static extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + IsExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + IsExtension.toObject), + 0); + /** + * optional string ext1 = 1; + * @return {string} + */ + getExt1() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.MineField} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.MineField} - */ -MineField.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setCookie(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * @param {string} value + * @return {!proto.jspb.test.IsExtension} returns this + */ + setExt1(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -MineField.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - MineField.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.IsExtension} returns this + */ + clearExt1() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.MineField} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -MineField.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeString( - 1, - f - ); - } -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasExt1() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * optional string cookie = 1; - * @return {string} - */ -MineField.prototype.getCookie = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; + + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.IsExtension} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new IsExtension; + return IsExtension.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.MineField} returns this - */ -MineField.prototype.setCookie = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.IsExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.IsExtension} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setExt1(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.MineField} returns this - */ -MineField.prototype.clearCookie = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + IsExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -MineField.prototype.hasCookie = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.IsExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + }; +} @@ -3658,149 +3119,6 @@ ext1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.IsExtension} - */ -IsExtension.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new IsExtension; - return IsExtension.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.IsExtension} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.IsExtension} - */ -IsExtension.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setExt1(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -IsExtension.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - IsExtension.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.IsExtension} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -IsExtension.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeString( - 1, - f - ); - } -}; - - - -/** - * A tuple of {field number, class constructor} for the extension - * field named `extField`. - * @type {!jspb.ExtensionFieldInfo} - */ -IsExtension.extField = new jspb.ExtensionFieldInfo( - 100, - {extField: 0}, - IsExtension, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - IsExtension.toObject), - 0); - -HasExtensions.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( - IsExtension.extField, - jspb.BinaryReader.prototype.readMessage, - jspb.BinaryWriter.prototype.writeMessage, - IsExtension.serializeBinaryToWriter, - IsExtension.deserializeBinaryFromReader, - false); -// This registers the extension field with the extended class, so that -// toObject() will function correctly. -HasExtensions.extensions[100] = IsExtension.extField; - -/** - * optional string ext1 = 1; - * @return {string} - */ -IsExtension.prototype.getExt1 = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; - - -/** - * @param {string} value - * @return {!proto.jspb.test.IsExtension} returns this - */ -IsExtension.prototype.setExt1 = function(value) { - return jspb.Message.setField(this, 1, value); -}; - - -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.IsExtension} returns this - */ -IsExtension.prototype.clearExt1 = function() { - return jspb.Message.setField(this, 1, undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -IsExtension.prototype.hasExt1 = function() { - return jspb.Message.getField(this, 1) != null; -}; - - - -/** - * A tuple of {field number, class constructor} for the extension - * field named `extField`. - * @type {!jspb.ExtensionFieldInfo} - */ -IsExtension.extField = new jspb.ExtensionFieldInfo( - 100, - {extField: 0}, - IsExtension, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - IsExtension.toObject), - 0); HasExtensions.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( IsExtension.extField, @@ -3813,245 +3131,174 @@ HasExtensions.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( // toObject() will function correctly. HasExtensions.extensions[100] = IsExtension.extField; - -/** - * A tuple of {field number, class constructor} for the extension - * field named `simpleOption`. - * @type {!jspb.ExtensionFieldInfo} - */ -IsExtension.simpleOption = new jspb.ExtensionFieldInfo( - 42113038, - {simpleOption: 0}, - null, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - null), - 0); - -google_protobuf_descriptor_pb.EnumOptions.extensionsBinary[42113038] = new jspb.ExtensionFieldBinaryInfo( - IsExtension.simpleOption, - jspb.BinaryReader.prototype.readString, - jspb.BinaryWriter.prototype.writeString, - undefined, - undefined, - false); -// This registers the extension field with the extended class, so that -// toObject() will function correctly. -google_protobuf_descriptor_pb.EnumOptions.extensions[42113038] = IsExtension.simpleOption; - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -IndirectExtension.prototype.toObject = function(opt_includeInstance) { - return IndirectExtension.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.jspb.test.IndirectExtension} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -IndirectExtension.toObject = function(includeInstance, msg) { - var f, obj = { - +export class IndirectExtension extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.IndirectExtension} - */ -IndirectExtension.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new IndirectExtension; - return IndirectExtension.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.IndirectExtension} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.IndirectExtension} - */ -IndirectExtension.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -IndirectExtension.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - IndirectExtension.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - + /** + * A tuple of {field number, class constructor} for the extension + * field named `simple`. + * @type {!jspb.ExtensionFieldInfo} + */ + static simple = new jspb.ExtensionFieldInfo( + 101, + {simple: 0}, + Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + Simple1.toObject), + 0); -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.IndirectExtension} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -IndirectExtension.serializeBinaryToWriter = function(message, writer) { - var f = undefined; -}; + /** + * A tuple of {field number, class constructor} for the extension + * field named `str`. + * @type {!jspb.ExtensionFieldInfo} + */ + static str = new jspb.ExtensionFieldInfo( + 102, + {str: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + /** + * A tuple of {field number, class constructor} for the extension + * field named `repeatedStrList`. + * @type {!jspb.ExtensionFieldInfo>} + */ + static repeatedStrList = new jspb.ExtensionFieldInfo( + 103, + {repeatedStrList: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 1); + /** + * A tuple of {field number, class constructor} for the extension + * field named `repeatedSimpleList`. + * @type {!jspb.ExtensionFieldInfo>} + */ + static repeatedSimpleList = new jspb.ExtensionFieldInfo( + 104, + {repeatedSimpleList: 0}, + Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + Simple1.toObject), + 1); + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.IndirectExtension} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new IndirectExtension; + return IndirectExtension.deserializeBinaryFromReader(msg, reader); + }; -/** - * A tuple of {field number, class constructor} for the extension - * field named `simple`. - * @type {!jspb.ExtensionFieldInfo} - */ -IndirectExtension.simple = new jspb.ExtensionFieldInfo( - 101, - {simple: 0}, - Simple1, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - Simple1.toObject), - 0); -HasExtensions.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( - IndirectExtension.simple, - jspb.BinaryReader.prototype.readMessage, - jspb.BinaryWriter.prototype.writeMessage, - Simple1.serializeBinaryToWriter, - Simple1.deserializeBinaryFromReader, - false); -// This registers the extension field with the extended class, so that -// toObject() will function correctly. -HasExtensions.extensions[101] = IndirectExtension.simple; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.IndirectExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.IndirectExtension} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * A tuple of {field number, class constructor} for the extension - * field named `str`. - * @type {!jspb.ExtensionFieldInfo} - */ -IndirectExtension.str = new jspb.ExtensionFieldInfo( - 102, - {str: 0}, - null, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - null), - 0); + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + IndirectExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( - IndirectExtension.str, - jspb.BinaryReader.prototype.readString, - jspb.BinaryWriter.prototype.writeString, - undefined, - undefined, - false); -// This registers the extension field with the extended class, so that -// toObject() will function correctly. -HasExtensions.extensions[102] = IndirectExtension.str; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.IndirectExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + }; -/** - * A tuple of {field number, class constructor} for the extension - * field named `repeatedStrList`. - * @type {!jspb.ExtensionFieldInfo>} - */ -IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( - 103, - {repeatedStrList: 0}, - null, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - null), - 1); -HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBinaryInfo( - IndirectExtension.repeatedStrList, - jspb.BinaryReader.prototype.readString, - jspb.BinaryWriter.prototype.writeRepeatedString, - undefined, - undefined, - false); -// This registers the extension field with the extended class, so that -// toObject() will function correctly. -HasExtensions.extensions[103] = IndirectExtension.repeatedStrList; +} + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * A tuple of {field number, class constructor} for the extension - * field named `repeatedSimpleList`. - * @type {!jspb.ExtensionFieldInfo>} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -IndirectExtension.repeatedSimpleList = new jspb.ExtensionFieldInfo( - 104, - {repeatedSimpleList: 0}, - Simple1, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - Simple1.toObject), - 1); - -HasExtensions.extensionsBinary[104] = new jspb.ExtensionFieldBinaryInfo( - IndirectExtension.repeatedSimpleList, - jspb.BinaryReader.prototype.readMessage, - jspb.BinaryWriter.prototype.writeRepeatedMessage, - Simple1.serializeBinaryToWriter, - Simple1.deserializeBinaryFromReader, - false); -// This registers the extension field with the extended class, so that -// toObject() will function correctly. -HasExtensions.extensions[104] = IndirectExtension.repeatedSimpleList; +IndirectExtension.prototype.toObject = function(opt_includeInstance) { + return IndirectExtension.toObject(opt_includeInstance, this); +}; /** - * A tuple of {field number, class constructor} for the extension - * field named `simple`. - * @type {!jspb.ExtensionFieldInfo} + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.IndirectExtension} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -IndirectExtension.simple = new jspb.ExtensionFieldInfo( - 101, - {simple: 0}, - Simple1, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - Simple1.toObject), - 0); +IndirectExtension.toObject = function(includeInstance, msg) { + var f, obj = { + + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + HasExtensions.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( IndirectExtension.simple, @@ -4065,19 +3312,6 @@ HasExtensions.extensionsBinary[101] = new jspb.ExtensionFieldBinaryInfo( HasExtensions.extensions[101] = IndirectExtension.simple; -/** - * A tuple of {field number, class constructor} for the extension - * field named `str`. - * @type {!jspb.ExtensionFieldInfo} - */ -IndirectExtension.str = new jspb.ExtensionFieldInfo( - 102, - {str: 0}, - null, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - null), - 0); - HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( IndirectExtension.str, jspb.BinaryReader.prototype.readString, @@ -4090,19 +3324,6 @@ HasExtensions.extensionsBinary[102] = new jspb.ExtensionFieldBinaryInfo( HasExtensions.extensions[102] = IndirectExtension.str; -/** - * A tuple of {field number, class constructor} for the extension - * field named `repeatedStrList`. - * @type {!jspb.ExtensionFieldInfo>} - */ -IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( - 103, - {repeatedStrList: 0}, - null, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - null), - 1); - HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBinaryInfo( IndirectExtension.repeatedStrList, jspb.BinaryReader.prototype.readString, @@ -4115,19 +3336,6 @@ HasExtensions.extensionsBinary[103] = new jspb.ExtensionFieldBinaryInfo( HasExtensions.extensions[103] = IndirectExtension.repeatedStrList; -/** - * A tuple of {field number, class constructor} for the extension - * field named `repeatedSimpleList`. - * @type {!jspb.ExtensionFieldInfo>} - */ -IndirectExtension.repeatedSimpleList = new jspb.ExtensionFieldInfo( - 104, - {repeatedSimpleList: 0}, - Simple1, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - Simple1.toObject), - 1); - HasExtensions.extensionsBinary[104] = new jspb.ExtensionFieldBinaryInfo( IndirectExtension.repeatedSimpleList, jspb.BinaryReader.prototype.readMessage, @@ -4139,433 +3347,393 @@ HasExtensions.extensionsBinary[104] = new jspb.ExtensionFieldBinaryInfo( // toObject() will function correctly. HasExtensions.extensions[104] = IndirectExtension.repeatedSimpleList; - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -DefaultValues.prototype.toObject = function(opt_includeInstance) { - return DefaultValues.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.jspb.test.DefaultValues} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -DefaultValues.toObject = function(includeInstance, msg) { - var f, obj = { -stringField: jspb.Message.getFieldWithDefault(msg, 1, "default\x3c\x3e\x27\x22abc"), -boolField: jspb.Message.getBooleanFieldWithDefault(msg, 2, true), -intField: jspb.Message.getFieldWithDefault(msg, 3, 11), -enumField: jspb.Message.getFieldWithDefault(msg, 4, 13), -emptyField: jspb.Message.getFieldWithDefault(msg, 6, ""), -bytesField: msg.getBytesField_asB64() +export class DefaultValues extends jspb.Message { + /** + * @enum {number} + */ + static Enum = { + E1: 13, + E2: 77 }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.DefaultValues} - */ -DefaultValues.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new DefaultValues; - return DefaultValues.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.DefaultValues} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.DefaultValues} - */ -DefaultValues.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setStringField(value); - break; - case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setBoolField(value); - break; - case 3: - var value = /** @type {number} */ (reader.readInt64()); - msg.setIntField(value); - break; - case 4: - var value = /** @type {!proto.jspb.test.DefaultValues.Enum} */ (reader.readEnum()); - msg.setEnumField(value); - break; - case 6: - var value = /** @type {string} */ (reader.readString()); - msg.setEmptyField(value); - break; - case 8: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setBytesField(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * optional string string_field = 1; + * @return {string} + */ + getStringField() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "default\x3c\x3e\x27\x22abc")); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -DefaultValues.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - DefaultValues.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ + setStringField(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.DefaultValues} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -DefaultValues.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeString( - 1, - f - ); - } - f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); - if (f != null) { - writer.writeBool( - 2, - f - ); - } - f = /** @type {number} */ (jspb.Message.getField(message, 3)); - if (f != null) { - writer.writeInt64( - 3, - f - ); - } - f = /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getField(message, 4)); - if (f != null) { - writer.writeEnum( - 4, - f - ); - } - f = /** @type {string} */ (jspb.Message.getField(message, 6)); - if (f != null) { - writer.writeString( - 6, - f - ); - } - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 8)); - if (f != null) { - writer.writeBytes( - 8, - f - ); - } -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ + clearStringField() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * @enum {number} - */ -DefaultValues.Enum = { - E1: 13, - E2: 77 -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasStringField() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * optional string string_field = 1; - * @return {string} - */ -DefaultValues.prototype.getStringField = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "default\x3c\x3e\x27\x22abc")); -}; + /** + * optional bool bool_field = 2; + * @return {boolean} + */ + getBoolField() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, true)); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.DefaultValues} returns this - */ -DefaultValues.prototype.setStringField = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * @param {boolean} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ + setBoolField(value) { + return jspb.Message.setField(this, 2, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.DefaultValues} returns this - */ -DefaultValues.prototype.clearStringField = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ + clearBoolField() { + return jspb.Message.setField(this, 2, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -DefaultValues.prototype.hasStringField = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasBoolField() { + return jspb.Message.getField(this, 2) != null; + }; -/** - * optional bool bool_field = 2; - * @return {boolean} - */ -DefaultValues.prototype.getBoolField = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, true)); -}; + /** + * optional int64 int_field = 3; + * @return {number} + */ + getIntField() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 11)); + }; -/** - * @param {boolean} value - * @return {!proto.jspb.test.DefaultValues} returns this - */ -DefaultValues.prototype.setBoolField = function(value) { - return jspb.Message.setField(this, 2, value); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ + setIntField(value) { + return jspb.Message.setField(this, 3, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.DefaultValues} returns this - */ -DefaultValues.prototype.clearBoolField = function() { - return jspb.Message.setField(this, 2, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ + clearIntField() { + return jspb.Message.setField(this, 3, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -DefaultValues.prototype.hasBoolField = function() { - return jspb.Message.getField(this, 2) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasIntField() { + return jspb.Message.getField(this, 3) != null; + }; -/** - * optional int64 int_field = 3; - * @return {number} - */ -DefaultValues.prototype.getIntField = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 11)); -}; + /** + * optional Enum enum_field = 4; + * @return {!proto.jspb.test.DefaultValues.Enum} + */ + getEnumField() { + return /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getFieldWithDefault(this, 4, 13)); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.DefaultValues} returns this - */ -DefaultValues.prototype.setIntField = function(value) { - return jspb.Message.setField(this, 3, value); -}; + /** + * @param {!proto.jspb.test.DefaultValues.Enum} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ + setEnumField(value) { + return jspb.Message.setField(this, 4, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.DefaultValues} returns this - */ -DefaultValues.prototype.clearIntField = function() { - return jspb.Message.setField(this, 3, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ + clearEnumField() { + return jspb.Message.setField(this, 4, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -DefaultValues.prototype.hasIntField = function() { - return jspb.Message.getField(this, 3) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasEnumField() { + return jspb.Message.getField(this, 4) != null; + }; -/** - * optional Enum enum_field = 4; - * @return {!proto.jspb.test.DefaultValues.Enum} - */ -DefaultValues.prototype.getEnumField = function() { - return /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getFieldWithDefault(this, 4, 13)); -}; + /** + * optional string empty_field = 6; + * @return {string} + */ + getEmptyField() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); + }; -/** - * @param {!proto.jspb.test.DefaultValues.Enum} value - * @return {!proto.jspb.test.DefaultValues} returns this - */ -DefaultValues.prototype.setEnumField = function(value) { - return jspb.Message.setField(this, 4, value); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ + setEmptyField(value) { + return jspb.Message.setField(this, 6, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.DefaultValues} returns this - */ -DefaultValues.prototype.clearEnumField = function() { - return jspb.Message.setField(this, 4, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ + clearEmptyField() { + return jspb.Message.setField(this, 6, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -DefaultValues.prototype.hasEnumField = function() { - return jspb.Message.getField(this, 4) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasEmptyField() { + return jspb.Message.getField(this, 6) != null; + }; -/** - * optional string empty_field = 6; - * @return {string} - */ -DefaultValues.prototype.getEmptyField = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); -}; + /** + * optional bytes bytes_field = 8; + * @return {!(string|Uint8Array)} + */ + getBytesField() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 8, "bW9v")); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.DefaultValues} returns this - */ -DefaultValues.prototype.setEmptyField = function(value) { - return jspb.Message.setField(this, 6, value); -}; + /** + * optional bytes bytes_field = 8; + * This is a type-conversion wrapper around `getBytesField()` + * @return {string} + */ + getBytesField_asB64() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBytesField())); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.DefaultValues} returns this - */ -DefaultValues.prototype.clearEmptyField = function() { - return jspb.Message.setField(this, 6, undefined); -}; + /** + * optional bytes bytes_field = 8; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getBytesField()` + * @return {!Uint8Array} + */ + getBytesField_asU8() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBytesField())); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -DefaultValues.prototype.hasEmptyField = function() { - return jspb.Message.getField(this, 6) != null; -}; + /** + * @param {!(string|Uint8Array)} value + * @return {!proto.jspb.test.DefaultValues} returns this + */ + setBytesField(value) { + return jspb.Message.setField(this, 8, value); + }; -/** - * optional bytes bytes_field = 8; - * @return {!(string|Uint8Array)} - */ -DefaultValues.prototype.getBytesField = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 8, "bW9v")); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.DefaultValues} returns this + */ + clearBytesField() { + return jspb.Message.setField(this, 8, undefined); + }; -/** - * optional bytes bytes_field = 8; - * This is a type-conversion wrapper around `getBytesField()` - * @return {string} - */ -DefaultValues.prototype.getBytesField_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getBytesField())); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasBytesField() { + return jspb.Message.getField(this, 8) != null; + }; -/** - * optional bytes bytes_field = 8; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getBytesField()` - * @return {!Uint8Array} - */ -DefaultValues.prototype.getBytesField_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getBytesField())); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.DefaultValues} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new DefaultValues; + return DefaultValues.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.jspb.test.DefaultValues} returns this - */ -DefaultValues.prototype.setBytesField = function(value) { - return jspb.Message.setField(this, 8, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.DefaultValues} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.DefaultValues} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStringField(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setBoolField(value); + break; + case 3: + var value = /** @type {number} */ (reader.readInt64()); + msg.setIntField(value); + break; + case 4: + var value = /** @type {!proto.jspb.test.DefaultValues.Enum} */ (reader.readEnum()); + msg.setEnumField(value); + break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setEmptyField(value); + break; + case 8: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBytesField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.DefaultValues} returns this - */ -DefaultValues.prototype.clearBytesField = function() { - return jspb.Message.setField(this, 8, undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + DefaultValues.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -DefaultValues.prototype.hasBytesField = function() { - return jspb.Message.getField(this, 8) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.DefaultValues} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeInt64( + 3, + f + ); + } + f = /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeEnum( + 4, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeString( + 6, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeBytes( + 8, + f + ); + } + }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -FloatingPointFields.repeatedFields_ = [3,7]; +} @@ -4582,8 +3750,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -FloatingPointFields.prototype.toObject = function(opt_includeInstance) { - return FloatingPointFields.toObject(opt_includeInstance, this); +DefaultValues.prototype.toObject = function(opt_includeInstance) { + return DefaultValues.toObject(opt_includeInstance, this); }; @@ -4592,20 +3760,18 @@ FloatingPointFields.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.FloatingPointFields} msg The msg instance to transform. + * @param {!proto.jspb.test.DefaultValues} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -FloatingPointFields.toObject = function(includeInstance, msg) { +DefaultValues.toObject = function(includeInstance, msg) { var f, obj = { -optionalFloatField: (f = jspb.Message.getOptionalFloatingPointField(msg, 1)) == null ? undefined : f, -requiredFloatField: (f = jspb.Message.getOptionalFloatingPointField(msg, 2)) == null ? undefined : f, -repeatedFloatFieldList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 3)) == null ? undefined : f, -defaultFloatField: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 2.0), -optionalDoubleField: (f = jspb.Message.getOptionalFloatingPointField(msg, 5)) == null ? undefined : f, -requiredDoubleField: (f = jspb.Message.getOptionalFloatingPointField(msg, 6)) == null ? undefined : f, -repeatedDoubleFieldList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 7)) == null ? undefined : f, -defaultDoubleField: jspb.Message.getFloatingPointFieldWithDefault(msg, 8, 2.0) +stringField: jspb.Message.getFieldWithDefault(msg, 1, "default\x3c\x3e\x27\x22abc"), +boolField: jspb.Message.getBooleanFieldWithDefault(msg, 2, true), +intField: jspb.Message.getFieldWithDefault(msg, 3, 11), +enumField: jspb.Message.getFieldWithDefault(msg, 4, 13), +emptyField: jspb.Message.getFieldWithDefault(msg, 6, ""), +bytesField: msg.getBytesField_asB64() }; if (includeInstance) { @@ -4616,453 +3782,468 @@ defaultDoubleField: jspb.Message.getFloatingPointFieldWithDefault(msg, 8, 2.0) } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.FloatingPointFields} - */ -FloatingPointFields.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new FloatingPointFields; - return FloatingPointFields.deserializeBinaryFromReader(msg, reader); -}; +export class FloatingPointFields extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, FloatingPointFields.repeatedFields_, null); + }; + /** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ + static repeatedFields_ = [3,7]; + /** + * optional float optional_float_field = 1; + * @return {number} + */ + getOptionalFloatField() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.FloatingPointFields} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.FloatingPointFields} - */ -FloatingPointFields.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readFloat()); - msg.setOptionalFloatField(value); - break; - case 2: - var value = /** @type {number} */ (reader.readFloat()); - msg.setRequiredFloatField(value); - break; - case 3: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readFloat() : [reader.readFloat()]); - for (var i = 0; i < values.length; i++) { - msg.addRepeatedFloatField(values[i]); - } - break; - case 4: - var value = /** @type {number} */ (reader.readFloat()); - msg.setDefaultFloatField(value); - break; - case 5: - var value = /** @type {number} */ (reader.readDouble()); - msg.setOptionalDoubleField(value); - break; - case 6: - var value = /** @type {number} */ (reader.readDouble()); - msg.setRequiredDoubleField(value); - break; - case 7: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readDouble() : [reader.readDouble()]); - for (var i = 0; i < values.length; i++) { - msg.addRepeatedDoubleField(values[i]); - } - break; - case 8: - var value = /** @type {number} */ (reader.readDouble()); - msg.setDefaultDoubleField(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + setOptionalFloatField(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -FloatingPointFields.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - FloatingPointFields.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + clearOptionalFloatField() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.FloatingPointFields} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -FloatingPointFields.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeFloat( - 1, - f - ); - } - f = /** @type {number} */ (jspb.Message.getField(message, 2)); - if (f != null) { - writer.writeFloat( - 2, - f - ); - } - f = message.getRepeatedFloatFieldList(); - if (f.length > 0) { - writer.writeRepeatedFloat( - 3, - f - ); - } - f = /** @type {number} */ (jspb.Message.getField(message, 4)); - if (f != null) { - writer.writeFloat( - 4, - f - ); - } - f = /** @type {number} */ (jspb.Message.getField(message, 5)); - if (f != null) { - writer.writeDouble( - 5, - f - ); - } - f = /** @type {number} */ (jspb.Message.getField(message, 6)); - if (f != null) { - writer.writeDouble( - 6, - f - ); - } - f = message.getRepeatedDoubleFieldList(); - if (f.length > 0) { - writer.writeRepeatedDouble( - 7, - f - ); - } - f = /** @type {number} */ (jspb.Message.getField(message, 8)); - if (f != null) { - writer.writeDouble( - 8, - f - ); - } -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasOptionalFloatField() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * optional float optional_float_field = 1; - * @return {number} - */ -FloatingPointFields.prototype.getOptionalFloatField = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 1, 0.0)); -}; + /** + * required float required_float_field = 2; + * @return {number} + */ + getRequiredFloatField() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.setOptionalFloatField = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + setRequiredFloatField(value) { + return jspb.Message.setField(this, 2, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.clearOptionalFloatField = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + clearRequiredFloatField() { + return jspb.Message.setField(this, 2, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -FloatingPointFields.prototype.hasOptionalFloatField = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasRequiredFloatField() { + return jspb.Message.getField(this, 2) != null; + }; -/** - * required float required_float_field = 2; - * @return {number} - */ -FloatingPointFields.prototype.getRequiredFloatField = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 2, 0.0)); -}; + /** + * repeated float repeated_float_field = 3; + * @return {!Array} + */ + getRepeatedFloatFieldList() { + return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 3)); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.setRequiredFloatField = function(value) { - return jspb.Message.setField(this, 2, value); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + setRepeatedFloatFieldList(value) { + return jspb.Message.setField(this, 3, value || []); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.clearRequiredFloatField = function() { - return jspb.Message.setField(this, 2, undefined); -}; + /** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + addRepeatedFloatField(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -FloatingPointFields.prototype.hasRequiredFloatField = function() { - return jspb.Message.getField(this, 2) != null; -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + clearRepeatedFloatFieldList() { + return this.setRepeatedFloatFieldList([]); + }; -/** - * repeated float repeated_float_field = 3; - * @return {!Array} - */ -FloatingPointFields.prototype.getRepeatedFloatFieldList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 3)); -}; + /** + * optional float default_float_field = 4; + * @return {number} + */ + getDefaultFloatField() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 2.0)); + }; -/** - * @param {!Array} value - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.setRepeatedFloatFieldList = function(value) { - return jspb.Message.setField(this, 3, value || []); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + setDefaultFloatField(value) { + return jspb.Message.setField(this, 4, value); + }; -/** - * @param {number} value - * @param {number=} opt_index - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.addRepeatedFloatField = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 3, value, opt_index); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + clearDefaultFloatField() { + return jspb.Message.setField(this, 4, undefined); + }; -/** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.clearRepeatedFloatFieldList = function() { - return this.setRepeatedFloatFieldList([]); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasDefaultFloatField() { + return jspb.Message.getField(this, 4) != null; + }; -/** - * optional float default_float_field = 4; - * @return {number} - */ -FloatingPointFields.prototype.getDefaultFloatField = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 4, 2.0)); -}; + /** + * optional double optional_double_field = 5; + * @return {number} + */ + getOptionalDoubleField() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.setDefaultFloatField = function(value) { - return jspb.Message.setField(this, 4, value); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + setOptionalDoubleField(value) { + return jspb.Message.setField(this, 5, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.clearDefaultFloatField = function() { - return jspb.Message.setField(this, 4, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + clearOptionalDoubleField() { + return jspb.Message.setField(this, 5, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -FloatingPointFields.prototype.hasDefaultFloatField = function() { - return jspb.Message.getField(this, 4) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasOptionalDoubleField() { + return jspb.Message.getField(this, 5) != null; + }; -/** - * optional double optional_double_field = 5; - * @return {number} - */ -FloatingPointFields.prototype.getOptionalDoubleField = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 5, 0.0)); -}; + /** + * required double required_double_field = 6; + * @return {number} + */ + getRequiredDoubleField() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 6, 0.0)); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.setOptionalDoubleField = function(value) { - return jspb.Message.setField(this, 5, value); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + setRequiredDoubleField(value) { + return jspb.Message.setField(this, 6, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.clearOptionalDoubleField = function() { - return jspb.Message.setField(this, 5, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + clearRequiredDoubleField() { + return jspb.Message.setField(this, 6, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -FloatingPointFields.prototype.hasOptionalDoubleField = function() { - return jspb.Message.getField(this, 5) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasRequiredDoubleField() { + return jspb.Message.getField(this, 6) != null; + }; -/** - * required double required_double_field = 6; - * @return {number} - */ -FloatingPointFields.prototype.getRequiredDoubleField = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 6, 0.0)); -}; + /** + * repeated double repeated_double_field = 7; + * @return {!Array} + */ + getRepeatedDoubleFieldList() { + return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 7)); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.setRequiredDoubleField = function(value) { - return jspb.Message.setField(this, 6, value); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + setRepeatedDoubleFieldList(value) { + return jspb.Message.setField(this, 7, value || []); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.clearRequiredDoubleField = function() { - return jspb.Message.setField(this, 6, undefined); -}; + /** + * @param {number} value + * @param {number=} opt_index + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + addRepeatedDoubleField(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 7, value, opt_index); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -FloatingPointFields.prototype.hasRequiredDoubleField = function() { - return jspb.Message.getField(this, 6) != null; -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + clearRepeatedDoubleFieldList() { + return this.setRepeatedDoubleFieldList([]); + }; -/** - * repeated double repeated_double_field = 7; - * @return {!Array} - */ -FloatingPointFields.prototype.getRepeatedDoubleFieldList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedFloatingPointField(this, 7)); -}; + /** + * optional double default_double_field = 8; + * @return {number} + */ + getDefaultDoubleField() { + return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 8, 2.0)); + }; -/** - * @param {!Array} value - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.setRepeatedDoubleFieldList = function(value) { - return jspb.Message.setField(this, 7, value || []); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + setDefaultDoubleField(value) { + return jspb.Message.setField(this, 8, value); + }; -/** - * @param {number} value - * @param {number=} opt_index - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.addRepeatedDoubleField = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 7, value, opt_index); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.FloatingPointFields} returns this + */ + clearDefaultDoubleField() { + return jspb.Message.setField(this, 8, undefined); + }; -/** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.clearRepeatedDoubleFieldList = function() { - return this.setRepeatedDoubleFieldList([]); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasDefaultDoubleField() { + return jspb.Message.getField(this, 8) != null; + }; -/** - * optional double default_double_field = 8; - * @return {number} - */ -FloatingPointFields.prototype.getDefaultDoubleField = function() { - return /** @type {number} */ (jspb.Message.getFloatingPointFieldWithDefault(this, 8, 2.0)); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.FloatingPointFields} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new FloatingPointFields; + return FloatingPointFields.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.setDefaultDoubleField = function(value) { - return jspb.Message.setField(this, 8, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.FloatingPointFields} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.FloatingPointFields} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readFloat()); + msg.setOptionalFloatField(value); + break; + case 2: + var value = /** @type {number} */ (reader.readFloat()); + msg.setRequiredFloatField(value); + break; + case 3: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readFloat() : [reader.readFloat()]); + for (var i = 0; i < values.length; i++) { + msg.addRepeatedFloatField(values[i]); + } + break; + case 4: + var value = /** @type {number} */ (reader.readFloat()); + msg.setDefaultFloatField(value); + break; + case 5: + var value = /** @type {number} */ (reader.readDouble()); + msg.setOptionalDoubleField(value); + break; + case 6: + var value = /** @type {number} */ (reader.readDouble()); + msg.setRequiredDoubleField(value); + break; + case 7: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readDouble() : [reader.readDouble()]); + for (var i = 0; i < values.length; i++) { + msg.addRepeatedDoubleField(values[i]); + } + break; + case 8: + var value = /** @type {number} */ (reader.readDouble()); + msg.setDefaultDoubleField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.FloatingPointFields} returns this - */ -FloatingPointFields.prototype.clearDefaultDoubleField = function() { - return jspb.Message.setField(this, 8, undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + FloatingPointFields.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -FloatingPointFields.prototype.hasDefaultDoubleField = function() { - return jspb.Message.getField(this, 8) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.FloatingPointFields} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeFloat( + 1, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeFloat( + 2, + f + ); + } + f = message.getRepeatedFloatFieldList(); + if (f.length > 0) { + writer.writeRepeatedFloat( + 3, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeFloat( + 4, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeDouble( + 5, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeDouble( + 6, + f + ); + } + f = message.getRepeatedDoubleFieldList(); + if (f.length > 0) { + writer.writeRepeatedDouble( + 7, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeDouble( + 8, + f + ); + } + }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -BooleanFields.repeatedFields_ = [3]; +} @@ -5079,8 +4260,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -BooleanFields.prototype.toObject = function(opt_includeInstance) { - return BooleanFields.toObject(opt_includeInstance, this); +FloatingPointFields.prototype.toObject = function(opt_includeInstance) { + return FloatingPointFields.toObject(opt_includeInstance, this); }; @@ -5089,16 +4270,20 @@ BooleanFields.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.BooleanFields} msg The msg instance to transform. + * @param {!proto.jspb.test.FloatingPointFields} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -BooleanFields.toObject = function(includeInstance, msg) { +FloatingPointFields.toObject = function(includeInstance, msg) { var f, obj = { -optionalBooleanField: (f = jspb.Message.getBooleanField(msg, 1)) == null ? undefined : f, -requiredBooleanField: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, -repeatedBooleanFieldList: (f = jspb.Message.getRepeatedBooleanField(msg, 3)) == null ? undefined : f, -defaultBooleanField: jspb.Message.getBooleanFieldWithDefault(msg, 4, true) +optionalFloatField: (f = jspb.Message.getOptionalFloatingPointField(msg, 1)) == null ? undefined : f, +requiredFloatField: (f = jspb.Message.getOptionalFloatingPointField(msg, 2)) == null ? undefined : f, +repeatedFloatFieldList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 3)) == null ? undefined : f, +defaultFloatField: jspb.Message.getFloatingPointFieldWithDefault(msg, 4, 2.0), +optionalDoubleField: (f = jspb.Message.getOptionalFloatingPointField(msg, 5)) == null ? undefined : f, +requiredDoubleField: (f = jspb.Message.getOptionalFloatingPointField(msg, 6)) == null ? undefined : f, +repeatedDoubleFieldList: (f = jspb.Message.getRepeatedFloatingPointField(msg, 7)) == null ? undefined : f, +defaultDoubleField: jspb.Message.getFloatingPointFieldWithDefault(msg, 8, 2.0) }; if (includeInstance) { @@ -5109,262 +4294,277 @@ defaultBooleanField: jspb.Message.getBooleanFieldWithDefault(msg, 4, true) } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.BooleanFields} - */ -BooleanFields.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new BooleanFields; - return BooleanFields.deserializeBinaryFromReader(msg, reader); -}; - +export class BooleanFields extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, BooleanFields.repeatedFields_, null); + }; + /** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ + static repeatedFields_ = [3]; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.BooleanFields} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.BooleanFields} - */ -BooleanFields.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setOptionalBooleanField(value); - break; - case 2: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setRequiredBooleanField(value); - break; - case 3: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readBool() : [reader.readBool()]); - for (var i = 0; i < values.length; i++) { - msg.addRepeatedBooleanField(values[i]); - } - break; - case 4: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setDefaultBooleanField(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * optional bool optional_boolean_field = 1; + * @return {boolean} + */ + getOptionalBooleanField() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -BooleanFields.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - BooleanFields.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * @param {boolean} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ + setOptionalBooleanField(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.BooleanFields} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -BooleanFields.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {boolean} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeBool( - 1, - f - ); - } - f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); - if (f != null) { - writer.writeBool( - 2, - f - ); - } - f = message.getRepeatedBooleanFieldList(); - if (f.length > 0) { - writer.writeRepeatedBool( - 3, - f - ); - } - f = /** @type {boolean} */ (jspb.Message.getField(message, 4)); - if (f != null) { - writer.writeBool( - 4, - f - ); - } -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.BooleanFields} returns this + */ + clearOptionalBooleanField() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * optional bool optional_boolean_field = 1; - * @return {boolean} - */ -BooleanFields.prototype.getOptionalBooleanField = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false)); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasOptionalBooleanField() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * @param {boolean} value - * @return {!proto.jspb.test.BooleanFields} returns this - */ -BooleanFields.prototype.setOptionalBooleanField = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * required bool required_boolean_field = 2; + * @return {boolean} + */ + getRequiredBooleanField() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.BooleanFields} returns this - */ -BooleanFields.prototype.clearOptionalBooleanField = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * @param {boolean} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ + setRequiredBooleanField(value) { + return jspb.Message.setField(this, 2, value); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -BooleanFields.prototype.hasOptionalBooleanField = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.BooleanFields} returns this + */ + clearRequiredBooleanField() { + return jspb.Message.setField(this, 2, undefined); + }; -/** - * required bool required_boolean_field = 2; - * @return {boolean} - */ -BooleanFields.prototype.getRequiredBooleanField = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 2, false)); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasRequiredBooleanField() { + return jspb.Message.getField(this, 2) != null; + }; -/** - * @param {boolean} value - * @return {!proto.jspb.test.BooleanFields} returns this - */ -BooleanFields.prototype.setRequiredBooleanField = function(value) { - return jspb.Message.setField(this, 2, value); -}; + /** + * repeated bool repeated_boolean_field = 3; + * @return {!Array} + */ + getRepeatedBooleanFieldList() { + return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 3)); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.BooleanFields} returns this - */ -BooleanFields.prototype.clearRequiredBooleanField = function() { - return jspb.Message.setField(this, 2, undefined); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ + setRepeatedBooleanFieldList(value) { + return jspb.Message.setField(this, 3, value || []); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -BooleanFields.prototype.hasRequiredBooleanField = function() { - return jspb.Message.getField(this, 2) != null; -}; + /** + * @param {boolean} value + * @param {number=} opt_index + * @return {!proto.jspb.test.BooleanFields} returns this + */ + addRepeatedBooleanField(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 3, value, opt_index); + }; -/** - * repeated bool repeated_boolean_field = 3; - * @return {!Array} - */ -BooleanFields.prototype.getRepeatedBooleanFieldList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 3)); -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.BooleanFields} returns this + */ + clearRepeatedBooleanFieldList() { + return this.setRepeatedBooleanFieldList([]); + }; -/** - * @param {!Array} value - * @return {!proto.jspb.test.BooleanFields} returns this - */ -BooleanFields.prototype.setRepeatedBooleanFieldList = function(value) { - return jspb.Message.setField(this, 3, value || []); -}; + /** + * optional bool default_boolean_field = 4; + * @return {boolean} + */ + getDefaultBooleanField() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, true)); + }; -/** - * @param {boolean} value - * @param {number=} opt_index - * @return {!proto.jspb.test.BooleanFields} returns this - */ -BooleanFields.prototype.addRepeatedBooleanField = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 3, value, opt_index); -}; + /** + * @param {boolean} value + * @return {!proto.jspb.test.BooleanFields} returns this + */ + setDefaultBooleanField(value) { + return jspb.Message.setField(this, 4, value); + }; -/** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.BooleanFields} returns this - */ -BooleanFields.prototype.clearRepeatedBooleanFieldList = function() { - return this.setRepeatedBooleanFieldList([]); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.BooleanFields} returns this + */ + clearDefaultBooleanField() { + return jspb.Message.setField(this, 4, undefined); + }; -/** - * optional bool default_boolean_field = 4; - * @return {boolean} - */ -BooleanFields.prototype.getDefaultBooleanField = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, true)); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasDefaultBooleanField() { + return jspb.Message.getField(this, 4) != null; + }; -/** - * @param {boolean} value - * @return {!proto.jspb.test.BooleanFields} returns this - */ -BooleanFields.prototype.setDefaultBooleanField = function(value) { - return jspb.Message.setField(this, 4, value); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.BooleanFields} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new BooleanFields; + return BooleanFields.deserializeBinaryFromReader(msg, reader); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.BooleanFields} returns this - */ -BooleanFields.prototype.clearDefaultBooleanField = function() { - return jspb.Message.setField(this, 4, undefined); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.BooleanFields} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.BooleanFields} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOptionalBooleanField(value); + break; + case 2: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setRequiredBooleanField(value); + break; + case 3: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readBool() : [reader.readBool()]); + for (var i = 0; i < values.length; i++) { + msg.addRepeatedBooleanField(values[i]); + } + break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setDefaultBooleanField(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -BooleanFields.prototype.hasDefaultBooleanField = function() { - return jspb.Message.getField(this, 4) != null; -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + BooleanFields.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.BooleanFields} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {boolean} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeBool( + 1, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBool( + 2, + f + ); + } + f = message.getRepeatedBooleanFieldList(); + if (f.length > 0) { + writer.writeRepeatedBool( + 3, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeBool( + 4, + f + ); + } + }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -TestClone.repeatedFields_ = [5]; + +} @@ -5381,8 +4581,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -TestClone.prototype.toObject = function(opt_includeInstance) { - return TestClone.toObject(opt_includeInstance, this); +BooleanFields.prototype.toObject = function(opt_includeInstance) { + return BooleanFields.toObject(opt_includeInstance, this); }; @@ -5391,23 +4591,18 @@ TestClone.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestClone} msg The msg instance to transform. + * @param {!proto.jspb.test.BooleanFields} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestClone.toObject = function(includeInstance, msg) { +BooleanFields.toObject = function(includeInstance, msg) { var f, obj = { -str: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, -simple1: (f = msg.getSimple1()) && Simple1.toObject(includeInstance, f), -simple2List: jspb.Message.toObjectList(msg.getSimple2List(), - Simple1.toObject, includeInstance), -bytesField: msg.getBytesField_asB64(), -unused: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f +optionalBooleanField: (f = jspb.Message.getBooleanField(msg, 1)) == null ? undefined : f, +requiredBooleanField: (f = jspb.Message.getBooleanField(msg, 2)) == null ? undefined : f, +repeatedBooleanFieldList: (f = jspb.Message.getRepeatedBooleanField(msg, 3)) == null ? undefined : f, +defaultBooleanField: jspb.Message.getBooleanFieldWithDefault(msg, 4, true) }; - jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, - TestClone.extensions, TestClone.prototype.getExtension, - includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; } @@ -5416,335 +4611,387 @@ unused: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestClone} - */ -TestClone.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestClone; - return TestClone.deserializeBinaryFromReader(msg, reader); -}; - +export class TestClone extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 8, TestClone.repeatedFields_, null); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestClone} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestClone} - */ -TestClone.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setStr(value); - break; - case 3: - var value = new Simple1; - reader.readMessage(value,Simple1.deserializeBinaryFromReader); - msg.setSimple1(value); - break; - case 5: - var value = new Simple1; - reader.readMessage(value,Simple1.deserializeBinaryFromReader); - msg.addSimple2(value); - break; - case 6: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setBytesField(value); - break; - case 7: - var value = /** @type {string} */ (reader.readString()); - msg.setUnused(value); - break; - default: - jspb.Message.readBinaryExtension(msg, reader, - TestClone.extensionsBinary, - TestClone.prototype.getExtension, - TestClone.prototype.setExtension); - break; - } - } - return msg; -}; + /** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ + static extensions = {}; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestClone.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestClone.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ + static extensionsBinary = {}; + /** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ + static repeatedFields_ = [5]; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestClone} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestClone.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeString( - 1, - f - ); - } - f = message.getSimple1(); - if (f != null) { - writer.writeMessage( - 3, - f, - Simple1.serializeBinaryToWriter - ); - } - f = message.getSimple2List(); - if (f.length > 0) { - writer.writeRepeatedMessage( - 5, - f, - Simple1.serializeBinaryToWriter - ); - } - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 6)); - if (f != null) { - writer.writeBytes( - 6, - f - ); - } - f = /** @type {string} */ (jspb.Message.getField(message, 7)); - if (f != null) { - writer.writeString( - 7, - f - ); - } - jspb.Message.serializeBinaryExtensions(message, writer, - TestClone.extensionsBinary, TestClone.prototype.getExtension); -}; + /** + * optional string str = 1; + * @return {string} + */ + getStr() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); + }; -/** - * optional string str = 1; - * @return {string} - */ -TestClone.prototype.getStr = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.TestClone} returns this + */ + setStr(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.TestClone} returns this - */ -TestClone.prototype.setStr = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ + clearStr() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestClone} returns this - */ -TestClone.prototype.clearStr = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasStr() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestClone.prototype.hasStr = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * optional Simple1 simple1 = 3; + * @return {?proto.jspb.test.Simple1} + */ + getSimple1() { + return /** @type{?proto.jspb.test.Simple1} */ ( + jspb.Message.getWrapperField(this, Simple1, 3)); + }; -/** - * optional Simple1 simple1 = 3; - * @return {?proto.jspb.test.Simple1} - */ -TestClone.prototype.getSimple1 = function() { - return /** @type{?proto.jspb.test.Simple1} */ ( - jspb.Message.getWrapperField(this, Simple1, 3)); -}; + /** + * @param {?proto.jspb.test.Simple1|undefined} value + * @return {!proto.jspb.test.TestClone} returns this + */ + setSimple1(value) { + return jspb.Message.setWrapperField(this, 3, value); + }; -/** - * @param {?proto.jspb.test.Simple1|undefined} value - * @return {!proto.jspb.test.TestClone} returns this -*/ -TestClone.prototype.setSimple1 = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; + /** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ + clearSimple1() { + return this.setSimple1(undefined); + }; -/** - * Clears the message field making it undefined. - * @return {!proto.jspb.test.TestClone} returns this - */ -TestClone.prototype.clearSimple1 = function() { - return this.setSimple1(undefined); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasSimple1() { + return jspb.Message.getField(this, 3) != null; + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestClone.prototype.hasSimple1 = function() { - return jspb.Message.getField(this, 3) != null; -}; + /** + * repeated Simple1 simple2 = 5; + * @return {!Array} + */ + getSimple2List() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, Simple1, 5)); + }; -/** - * repeated Simple1 simple2 = 5; - * @return {!Array} - */ -TestClone.prototype.getSimple2List = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, Simple1, 5)); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.TestClone} returns this + */ + setSimple2List(value) { + return jspb.Message.setRepeatedWrapperField(this, 5, value); + }; -/** - * @param {!Array} value - * @return {!proto.jspb.test.TestClone} returns this -*/ -TestClone.prototype.setSimple2List = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 5, value); -}; + /** + * @param {!proto.jspb.test.Simple1=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.Simple1} + */ + addSimple2(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, Simple1, opt_index); + }; -/** - * @param {!proto.jspb.test.Simple1=} opt_value - * @param {number=} opt_index - * @return {!proto.jspb.test.Simple1} - */ -TestClone.prototype.addSimple2 = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, Simple1, opt_index); -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestClone} returns this + */ + clearSimple2List() { + return this.setSimple2List([]); + }; -/** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.TestClone} returns this - */ -TestClone.prototype.clearSimple2List = function() { - return this.setSimple2List([]); -}; + /** + * optional bytes bytes_field = 6; + * @return {!(string|Uint8Array)} + */ + getBytesField() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 6, "")); + }; -/** - * optional bytes bytes_field = 6; - * @return {!(string|Uint8Array)} - */ -TestClone.prototype.getBytesField = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 6, "")); -}; + /** + * optional bytes bytes_field = 6; + * This is a type-conversion wrapper around `getBytesField()` + * @return {string} + */ + getBytesField_asB64() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getBytesField())); + }; -/** - * optional bytes bytes_field = 6; + /** + * optional bytes bytes_field = 6; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array * This is a type-conversion wrapper around `getBytesField()` - * @return {string} - */ -TestClone.prototype.getBytesField_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getBytesField())); -}; + * @return {!Uint8Array} + */ + getBytesField_asU8() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getBytesField())); + }; -/** - * optional bytes bytes_field = 6; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getBytesField()` - * @return {!Uint8Array} - */ -TestClone.prototype.getBytesField_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getBytesField())); -}; + /** + * @param {!(string|Uint8Array)} value + * @return {!proto.jspb.test.TestClone} returns this + */ + setBytesField(value) { + return jspb.Message.setField(this, 6, value); + }; -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.jspb.test.TestClone} returns this - */ -TestClone.prototype.setBytesField = function(value) { - return jspb.Message.setField(this, 6, value); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ + clearBytesField() { + return jspb.Message.setField(this, 6, undefined); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestClone} returns this - */ -TestClone.prototype.clearBytesField = function() { - return jspb.Message.setField(this, 6, undefined); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasBytesField() { + return jspb.Message.getField(this, 6) != null; + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestClone.prototype.hasBytesField = function() { - return jspb.Message.getField(this, 6) != null; -}; + /** + * optional string unused = 7; + * @return {string} + */ + getUnused() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); + }; -/** - * optional string unused = 7; - * @return {string} - */ -TestClone.prototype.getUnused = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.TestClone} returns this + */ + setUnused(value) { + return jspb.Message.setField(this, 7, value); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.TestClone} returns this - */ -TestClone.prototype.setUnused = function(value) { - return jspb.Message.setField(this, 7, value); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestClone} returns this + */ + clearUnused() { + return jspb.Message.setField(this, 7, undefined); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestClone} returns this - */ -TestClone.prototype.clearUnused = function() { - return jspb.Message.setField(this, 7, undefined); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasUnused() { + return jspb.Message.getField(this, 7) != null; + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestClone.prototype.hasUnused = function() { - return jspb.Message.getField(this, 7) != null; -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestClone} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestClone; + return TestClone.deserializeBinaryFromReader(msg, reader); + }; + + + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestClone} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestClone} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setStr(value); + break; + case 3: + var value = new Simple1; + reader.readMessage(value,Simple1.deserializeBinaryFromReader); + msg.setSimple1(value); + break; + case 5: + var value = new Simple1; + reader.readMessage(value,Simple1.deserializeBinaryFromReader); + msg.addSimple2(value); + break; + case 6: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setBytesField(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setUnused(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + TestClone.extensionsBinary, + TestClone.prototype.getExtension, + TestClone.prototype.setExtension); + break; + } + } + return msg; + }; + + + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestClone.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; + + + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestClone} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getSimple1(); + if (f != null) { + writer.writeMessage( + 3, + f, + Simple1.serializeBinaryToWriter + ); + } + f = message.getSimple2List(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 5, + f, + Simple1.serializeBinaryToWriter + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 6)); + if (f != null) { + writer.writeBytes( + 6, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeString( + 7, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + TestClone.extensionsBinary, TestClone.prototype.getExtension); + }; +} @@ -5761,8 +5008,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -TestCloneExtension.prototype.toObject = function(opt_includeInstance) { - return TestCloneExtension.toObject(opt_includeInstance, this); +TestClone.prototype.toObject = function(opt_includeInstance) { + return TestClone.toObject(opt_includeInstance, this); }; @@ -5771,15 +5018,23 @@ TestCloneExtension.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestCloneExtension} msg The msg instance to transform. + * @param {!proto.jspb.test.TestClone} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestCloneExtension.toObject = function(includeInstance, msg) { +TestClone.toObject = function(includeInstance, msg) { var f, obj = { -f: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f +str: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +simple1: (f = msg.getSimple1()) && Simple1.toObject(includeInstance, f), +simple2List: jspb.Message.toObjectList(msg.getSimple2List(), + Simple1.toObject, includeInstance), +bytesField: msg.getBytesField_asB64(), +unused: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f }; + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + TestClone.extensions, TestClone.prototype.getExtension, + includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; } @@ -5788,161 +5043,139 @@ f: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestCloneExtension} - */ -TestCloneExtension.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestCloneExtension; - return TestCloneExtension.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestCloneExtension} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestCloneExtension} - */ -TestCloneExtension.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setF(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestCloneExtension.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestCloneExtension.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - +export class TestCloneExtension extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestCloneExtension} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestCloneExtension.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeInt32( - 1, - f - ); - } -}; + /** + * A tuple of {field number, class constructor} for the extension + * field named `lowExt`. + * @type {!jspb.ExtensionFieldInfo} + */ + static lowExt = new jspb.ExtensionFieldInfo( + 11, + {lowExt: 0}, + TestCloneExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + TestCloneExtension.toObject), + 0); + /** + * optional int32 f = 1; + * @return {number} + */ + getF() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); + }; + /** + * @param {number} value + * @return {!proto.jspb.test.TestCloneExtension} returns this + */ + setF(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * A tuple of {field number, class constructor} for the extension - * field named `lowExt`. - * @type {!jspb.ExtensionFieldInfo} - */ -TestCloneExtension.lowExt = new jspb.ExtensionFieldInfo( - 11, - {lowExt: 0}, - TestCloneExtension, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - TestCloneExtension.toObject), - 0); -TestClone.extensionsBinary[11] = new jspb.ExtensionFieldBinaryInfo( - TestCloneExtension.lowExt, - jspb.BinaryReader.prototype.readMessage, - jspb.BinaryWriter.prototype.writeMessage, - TestCloneExtension.serializeBinaryToWriter, - TestCloneExtension.deserializeBinaryFromReader, - false); -// This registers the extension field with the extended class, so that -// toObject() will function correctly. -TestClone.extensions[11] = TestCloneExtension.lowExt; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestCloneExtension} returns this + */ + clearF() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * optional int32 f = 1; - * @return {number} - */ -TestCloneExtension.prototype.getF = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasF() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * @param {number} value - * @return {!proto.jspb.test.TestCloneExtension} returns this - */ -TestCloneExtension.prototype.setF = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestCloneExtension} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestCloneExtension; + return TestCloneExtension.deserializeBinaryFromReader(msg, reader); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestCloneExtension} returns this - */ -TestCloneExtension.prototype.clearF = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestCloneExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestCloneExtension} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setF(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestCloneExtension.prototype.hasF = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestCloneExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * A tuple of {field number, class constructor} for the extension - * field named `lowExt`. - * @type {!jspb.ExtensionFieldInfo} - */ -TestCloneExtension.lowExt = new jspb.ExtensionFieldInfo( - 11, - {lowExt: 0}, - TestCloneExtension, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - TestCloneExtension.toObject), - 0); + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestCloneExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + }; -TestClone.extensionsBinary[11] = new jspb.ExtensionFieldBinaryInfo( - TestCloneExtension.lowExt, - jspb.BinaryReader.prototype.readMessage, - jspb.BinaryWriter.prototype.writeMessage, - TestCloneExtension.serializeBinaryToWriter, - TestCloneExtension.deserializeBinaryFromReader, - false); -// This registers the extension field with the extended class, so that -// toObject() will function correctly. -TestClone.extensions[11] = TestCloneExtension.lowExt; +} @@ -5959,8 +5192,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -CloneExtension.prototype.toObject = function(opt_includeInstance) { - return CloneExtension.toObject(opt_includeInstance, this); +TestCloneExtension.prototype.toObject = function(opt_includeInstance) { + return TestCloneExtension.toObject(opt_includeInstance, this); }; @@ -5969,13 +5202,13 @@ CloneExtension.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.CloneExtension} msg The msg instance to transform. + * @param {!proto.jspb.test.TestCloneExtension} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -CloneExtension.toObject = function(includeInstance, msg) { +TestCloneExtension.toObject = function(includeInstance, msg) { var f, obj = { -ext: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f +f: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; if (includeInstance) { @@ -5986,358 +5219,151 @@ ext: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.CloneExtension} - */ -CloneExtension.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new CloneExtension; - return CloneExtension.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.CloneExtension} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.CloneExtension} - */ -CloneExtension.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setExt(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -CloneExtension.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - CloneExtension.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.CloneExtension} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -CloneExtension.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 2)); - if (f != null) { - writer.writeString( - 2, - f - ); - } -}; - - - -/** - * A tuple of {field number, class constructor} for the extension - * field named `extField`. - * @type {!jspb.ExtensionFieldInfo} - */ -CloneExtension.extField = new jspb.ExtensionFieldInfo( - 100, - {extField: 0}, - CloneExtension, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - CloneExtension.toObject), - 0); - -TestClone.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( - CloneExtension.extField, - jspb.BinaryReader.prototype.readMessage, - jspb.BinaryWriter.prototype.writeMessage, - CloneExtension.serializeBinaryToWriter, - CloneExtension.deserializeBinaryFromReader, - false); -// This registers the extension field with the extended class, so that -// toObject() will function correctly. -TestClone.extensions[100] = CloneExtension.extField; - -/** - * optional string ext = 2; - * @return {string} - */ -CloneExtension.prototype.getExt = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.jspb.test.CloneExtension} returns this - */ -CloneExtension.prototype.setExt = function(value) { - return jspb.Message.setField(this, 2, value); -}; - - -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.CloneExtension} returns this - */ -CloneExtension.prototype.clearExt = function() { - return jspb.Message.setField(this, 2, undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -CloneExtension.prototype.hasExt = function() { - return jspb.Message.getField(this, 2) != null; -}; - - -/** - * A tuple of {field number, class constructor} for the extension - * field named `extField`. - * @type {!jspb.ExtensionFieldInfo} - */ -CloneExtension.extField = new jspb.ExtensionFieldInfo( - 100, - {extField: 0}, - CloneExtension, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - CloneExtension.toObject), - 0); - -TestClone.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( - CloneExtension.extField, +TestClone.extensionsBinary[11] = new jspb.ExtensionFieldBinaryInfo( + TestCloneExtension.lowExt, jspb.BinaryReader.prototype.readMessage, jspb.BinaryWriter.prototype.writeMessage, - CloneExtension.serializeBinaryToWriter, - CloneExtension.deserializeBinaryFromReader, + TestCloneExtension.serializeBinaryToWriter, + TestCloneExtension.deserializeBinaryFromReader, false); // This registers the extension field with the extended class, so that // toObject() will function correctly. -TestClone.extensions[100] = CloneExtension.extField; - +TestClone.extensions[11] = TestCloneExtension.lowExt; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -TestGroup.repeatedFields_ = [1]; +export class CloneExtension extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ + static extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + CloneExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + CloneExtension.toObject), + 0); + /** + * optional string ext = 2; + * @return {string} + */ + getExt() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); + }; -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -TestGroup.prototype.toObject = function(opt_includeInstance) { - return TestGroup.toObject(opt_includeInstance, this); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.CloneExtension} returns this + */ + setExt(value) { + return jspb.Message.setField(this, 2, value); + }; -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestGroup} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestGroup.toObject = function(includeInstance, msg) { - var f, obj = { -repeatedGroupList: jspb.Message.toObjectList(msg.getRepeatedGroupList(), - TestGroup.RepeatedGroup.toObject, includeInstance), -requiredGroup: (f = msg.getRequiredGroup()) && TestGroup.RequiredGroup.toObject(includeInstance, f), -optionalGroup: (f = msg.getOptionalGroup()) && TestGroup.OptionalGroup.toObject(includeInstance, f), -id: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f, -requiredSimple: (f = msg.getRequiredSimple()) && Simple2.toObject(includeInstance, f), -optionalSimple: (f = msg.getOptionalSimple()) && Simple2.toObject(includeInstance, f) + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.CloneExtension} returns this + */ + clearExt() { + return jspb.Message.setField(this, 2, undefined); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasExt() { + return jspb.Message.getField(this, 2) != null; + }; -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestGroup} - */ -TestGroup.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestGroup; - return TestGroup.deserializeBinaryFromReader(msg, reader); -}; + + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.CloneExtension} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new CloneExtension; + return CloneExtension.deserializeBinaryFromReader(msg, reader); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestGroup} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestGroup} - */ -TestGroup.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new TestGroup.RepeatedGroup; - reader.readGroup(1, value,TestGroup.RepeatedGroup.deserializeBinaryFromReader); - msg.addRepeatedGroup(value); - break; - case 2: - var value = new TestGroup.RequiredGroup; - reader.readGroup(2, value,TestGroup.RequiredGroup.deserializeBinaryFromReader); - msg.setRequiredGroup(value); - break; - case 3: - var value = new TestGroup.OptionalGroup; - reader.readGroup(3, value,TestGroup.OptionalGroup.deserializeBinaryFromReader); - msg.setOptionalGroup(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.setId(value); - break; - case 5: - var value = new Simple2; - reader.readMessage(value,Simple2.deserializeBinaryFromReader); - msg.setRequiredSimple(value); - break; - case 6: - var value = new Simple2; - reader.readMessage(value,Simple2.deserializeBinaryFromReader); - msg.setOptionalSimple(value); - break; - default: - reader.skipField(); - break; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.CloneExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.CloneExtension} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setExt(value); + break; + default: + reader.skipField(); + break; + } } - } - return msg; -}; - + return msg; + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestGroup.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestGroup.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + CloneExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestGroup} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestGroup.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getRepeatedGroupList(); - if (f.length > 0) { - writer.writeRepeatedGroup( - 1, - f, - TestGroup.RepeatedGroup.serializeBinaryToWriter - ); - } - f = message.getRequiredGroup(); - if (f != null) { - writer.writeGroup( - 2, - f, - TestGroup.RequiredGroup.serializeBinaryToWriter - ); - } - f = message.getOptionalGroup(); - if (f != null) { - writer.writeGroup( - 3, - f, - TestGroup.OptionalGroup.serializeBinaryToWriter - ); - } - f = /** @type {string} */ (jspb.Message.getField(message, 4)); - if (f != null) { - writer.writeString( - 4, - f - ); - } - f = message.getRequiredSimple(); - if (f != null) { - writer.writeMessage( - 5, - f, - Simple2.serializeBinaryToWriter - ); - } - f = message.getOptionalSimple(); - if (f != null) { - writer.writeMessage( - 6, - f, - Simple2.serializeBinaryToWriter - ); - } -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.CloneExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeString( + 2, + f + ); + } + }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -TestGroup.RepeatedGroup.repeatedFields_ = [1]; +} @@ -6354,8 +5380,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -TestGroup.RepeatedGroup.prototype.toObject = function(opt_includeInstance) { - return TestGroup.RepeatedGroup.toObject(opt_includeInstance, this); +CloneExtension.prototype.toObject = function(opt_includeInstance) { + return CloneExtension.toObject(opt_includeInstance, this); }; @@ -6364,14 +5390,13 @@ TestGroup.RepeatedGroup.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestGroup.RepeatedGroup} msg The msg instance to transform. + * @param {!proto.jspb.test.CloneExtension} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestGroup.RepeatedGroup.toObject = function(includeInstance, msg) { +CloneExtension.toObject = function(includeInstance, msg) { var f, obj = { -id: (f = jspb.Message.getField(msg, 0)) == null ? undefined : f, -someBoolList: (f = jspb.Message.getRepeatedBooleanField(msg, 1)) == null ? undefined : f +ext: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f }; if (includeInstance) { @@ -6382,309 +5407,396 @@ someBoolList: (f = jspb.Message.getRepeatedBooleanField(msg, 1)) == null ? undef } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} - */ -TestGroup.RepeatedGroup.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestGroup.RepeatedGroup; - return TestGroup.RepeatedGroup.deserializeBinaryFromReader(msg, reader); -}; +TestClone.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( + CloneExtension.extField, + jspb.BinaryReader.prototype.readMessage, + jspb.BinaryWriter.prototype.writeMessage, + CloneExtension.serializeBinaryToWriter, + CloneExtension.deserializeBinaryFromReader, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +TestClone.extensions[100] = CloneExtension.extField; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestGroup.RepeatedGroup} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} - */ -TestGroup.RepeatedGroup.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setId(value); - break; - case 2: - var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readBool() : [reader.readBool()]); - for (var i = 0; i < values.length; i++) { - msg.addSomeBool(values[i]); - } - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; +export class TestGroup extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, TestGroup.repeatedFields_, null); + }; + /** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ + static repeatedFields_ = [1]; + /** + * repeated group RepeatedGroup = 1; + * @return {!Array} + */ + getRepeatedGroupList() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, TestGroup.RepeatedGroup, 1)); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestGroup.RepeatedGroup.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestGroup.RepeatedGroup.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.TestGroup} returns this + */ + setRepeatedGroupList(value) { + return jspb.Message.setRepeatedWrapperField(this, 1, value); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestGroup.RepeatedGroup} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestGroup.RepeatedGroup.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 0)); - if (f != null) { - writer.writeString( - 1, - f - ); - } - f = message.getSomeBoolList(); - if (f.length > 0) { - writer.writeRepeatedBool( - 2, - f - ); - } -}; + /** + * @param {!proto.jspb.test.TestGroup.RepeatedGroup=} opt_value + * @param {number=} opt_index + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + */ + addRepeatedGroup(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, TestGroup.RepeatedGroup, opt_index); + }; -/** - * required string id = 1; - * @return {string} - */ -TestGroup.RepeatedGroup.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 0, "")); -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestGroup} returns this + */ + clearRepeatedGroupList() { + return this.setRepeatedGroupList([]); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this - */ -TestGroup.RepeatedGroup.prototype.setId = function(value) { - return jspb.Message.setField(this, 0, value); -}; + /** + * required group RequiredGroup = 2; + * @return {!proto.jspb.test.TestGroup.RequiredGroup} + */ + getRequiredGroup() { + return /** @type{!proto.jspb.test.TestGroup.RequiredGroup} */ ( + jspb.Message.getWrapperField(this, TestGroup.RequiredGroup, 2, 1)); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this - */ -TestGroup.RepeatedGroup.prototype.clearId = function() { - return jspb.Message.setField(this, 0, undefined); -}; + /** + * @param {!proto.jspb.test.TestGroup.RequiredGroup} value + * @return {!proto.jspb.test.TestGroup} returns this + */ + setRequiredGroup(value) { + return jspb.Message.setWrapperField(this, 2, value); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestGroup.RepeatedGroup.prototype.hasId = function() { - return jspb.Message.getField(this, 0) != null; -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ + clearRequiredGroup() { + return jspb.Message.setField(this, 2, undefined); + }; -/** - * repeated bool some_bool = 2; - * @return {!Array} - */ -TestGroup.RepeatedGroup.prototype.getSomeBoolList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 1)); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasRequiredGroup() { + return jspb.Message.getField(this, 2) != null; + }; -/** - * @param {!Array} value - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this - */ -TestGroup.RepeatedGroup.prototype.setSomeBoolList = function(value) { - return jspb.Message.setField(this, 1, value || []); -}; + /** + * optional group OptionalGroup = 3; + * @return {?proto.jspb.test.TestGroup.OptionalGroup} + */ + getOptionalGroup() { + return /** @type{?proto.jspb.test.TestGroup.OptionalGroup} */ ( + jspb.Message.getWrapperField(this, TestGroup.OptionalGroup, 3)); + }; -/** - * @param {boolean} value - * @param {number=} opt_index - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this - */ -TestGroup.RepeatedGroup.prototype.addSomeBool = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 1, value, opt_index); -}; + /** + * @param {?proto.jspb.test.TestGroup.OptionalGroup|undefined} value + * @return {!proto.jspb.test.TestGroup} returns this + */ + setOptionalGroup(value) { + return jspb.Message.setWrapperField(this, 3, value); + }; -/** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this - */ -TestGroup.RepeatedGroup.prototype.clearSomeBoolList = function() { - return this.setSomeBoolList([]); -}; + /** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ + clearOptionalGroup() { + return this.setOptionalGroup(undefined); + }; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasOptionalGroup() { + return jspb.Message.getField(this, 3) != null; + }; -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -TestGroup.RequiredGroup.prototype.toObject = function(opt_includeInstance) { - return TestGroup.RequiredGroup.toObject(opt_includeInstance, this); -}; + /** + * optional string id = 4; + * @return {string} + */ + getId() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); + }; -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestGroup.RequiredGroup} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestGroup.RequiredGroup.toObject = function(includeInstance, msg) { - var f, obj = { -id: (f = jspb.Message.getField(msg, -1)) == null ? undefined : f + /** + * @param {string} value + * @return {!proto.jspb.test.TestGroup} returns this + */ + setId(value) { + return jspb.Message.setField(this, 4, value); }; - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} + + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ + clearId() { + return jspb.Message.setField(this, 4, undefined); + }; -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestGroup.RequiredGroup} - */ -TestGroup.RequiredGroup.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestGroup.RequiredGroup; - return TestGroup.RequiredGroup.deserializeBinaryFromReader(msg, reader); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasId() { + return jspb.Message.getField(this, 4) != null; + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestGroup.RequiredGroup} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestGroup.RequiredGroup} - */ -TestGroup.RequiredGroup.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setId(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * required Simple2 required_simple = 5; + * @return {!proto.jspb.test.Simple2} + */ + getRequiredSimple() { + return /** @type{!proto.jspb.test.Simple2} */ ( + jspb.Message.getWrapperField(this, Simple2, 5, 1)); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestGroup.RequiredGroup.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestGroup.RequiredGroup.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * @param {!proto.jspb.test.Simple2} value + * @return {!proto.jspb.test.TestGroup} returns this + */ + setRequiredSimple(value) { + return jspb.Message.setWrapperField(this, 5, value); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestGroup.RequiredGroup} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestGroup.RequiredGroup.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, -1)); - if (f != null) { - writer.writeString( - 1, - f - ); - } -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ + clearRequiredSimple() { + return jspb.Message.setField(this, 5, undefined); + }; -/** - * required string id = 1; - * @return {string} - */ -TestGroup.RequiredGroup.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, -1, "")); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasRequiredSimple() { + return jspb.Message.getField(this, 5) != null; + }; -/** - * @param {string} value - * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this - */ -TestGroup.RequiredGroup.prototype.setId = function(value) { - return jspb.Message.setField(this, -1, value); -}; + /** + * optional Simple2 optional_simple = 6; + * @return {?proto.jspb.test.Simple2} + */ + getOptionalSimple() { + return /** @type{?proto.jspb.test.Simple2} */ ( + jspb.Message.getWrapperField(this, Simple2, 6)); + }; + + + /** + * @param {?proto.jspb.test.Simple2|undefined} value + * @return {!proto.jspb.test.TestGroup} returns this + */ + setOptionalSimple(value) { + return jspb.Message.setWrapperField(this, 6, value); + }; + + + /** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestGroup} returns this + */ + clearOptionalSimple() { + return this.setOptionalSimple(undefined); + }; + + + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasOptionalSimple() { + return jspb.Message.getField(this, 6) != null; + }; + + + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestGroup; + return TestGroup.deserializeBinaryFromReader(msg, reader); + }; + + + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new TestGroup.RepeatedGroup; + reader.readGroup(1, value,TestGroup.RepeatedGroup.deserializeBinaryFromReader); + msg.addRepeatedGroup(value); + break; + case 2: + var value = new TestGroup.RequiredGroup; + reader.readGroup(2, value,TestGroup.RequiredGroup.deserializeBinaryFromReader); + msg.setRequiredGroup(value); + break; + case 3: + var value = new TestGroup.OptionalGroup; + reader.readGroup(3, value,TestGroup.OptionalGroup.deserializeBinaryFromReader); + msg.setOptionalGroup(value); + break; + case 4: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 5: + var value = new Simple2; + reader.readMessage(value,Simple2.deserializeBinaryFromReader); + msg.setRequiredSimple(value); + break; + case 6: + var value = new Simple2; + reader.readMessage(value,Simple2.deserializeBinaryFromReader); + msg.setOptionalSimple(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this - */ -TestGroup.RequiredGroup.prototype.clearId = function() { - return jspb.Message.setField(this, -1, undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestGroup.RequiredGroup.prototype.hasId = function() { - return jspb.Message.getField(this, -1) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = message.getRepeatedGroupList(); + if (f.length > 0) { + writer.writeRepeatedGroup( + 1, + f, + TestGroup.RepeatedGroup.serializeBinaryToWriter + ); + } + f = message.getRequiredGroup(); + if (f != null) { + writer.writeGroup( + 2, + f, + TestGroup.RequiredGroup.serializeBinaryToWriter + ); + } + f = message.getOptionalGroup(); + if (f != null) { + writer.writeGroup( + 3, + f, + TestGroup.OptionalGroup.serializeBinaryToWriter + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 4)); + if (f != null) { + writer.writeString( + 4, + f + ); + } + f = message.getRequiredSimple(); + if (f != null) { + writer.writeMessage( + 5, + f, + Simple2.serializeBinaryToWriter + ); + } + f = message.getOptionalSimple(); + if (f != null) { + writer.writeMessage( + 6, + f, + Simple2.serializeBinaryToWriter + ); + } + }; +} @@ -6701,8 +5813,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -TestGroup.OptionalGroup.prototype.toObject = function(opt_includeInstance) { - return TestGroup.OptionalGroup.toObject(opt_includeInstance, this); +TestGroup.prototype.toObject = function(opt_includeInstance) { + return TestGroup.toObject(opt_includeInstance, this); }; @@ -6711,13 +5823,19 @@ TestGroup.OptionalGroup.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestGroup.OptionalGroup} msg The msg instance to transform. + * @param {!proto.jspb.test.TestGroup} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestGroup.OptionalGroup.toObject = function(includeInstance, msg) { +TestGroup.toObject = function(includeInstance, msg) { var f, obj = { -id: (f = jspb.Message.getField(msg, -2)) == null ? undefined : f +repeatedGroupList: jspb.Message.toObjectList(msg.getRepeatedGroupList(), + TestGroup.RepeatedGroup.toObject, includeInstance), +requiredGroup: (f = msg.getRequiredGroup()) && TestGroup.RequiredGroup.toObject(includeInstance, f), +optionalGroup: (f = msg.getOptionalGroup()) && TestGroup.OptionalGroup.toObject(includeInstance, f), +id: (f = jspb.Message.getField(msg, 4)) == null ? undefined : f, +requiredSimple: (f = msg.getRequiredSimple()) && Simple2.toObject(includeInstance, f), +optionalSimple: (f = msg.getOptionalSimple()) && Simple2.toObject(includeInstance, f) }; if (includeInstance) { @@ -6728,333 +5846,347 @@ id: (f = jspb.Message.getField(msg, -2)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestGroup.OptionalGroup} - */ -TestGroup.OptionalGroup.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestGroup.OptionalGroup; - return TestGroup.OptionalGroup.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestGroup.OptionalGroup} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestGroup.OptionalGroup} - */ -TestGroup.OptionalGroup.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setId(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestGroup.OptionalGroup.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestGroup.OptionalGroup.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestGroup.OptionalGroup} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestGroup.OptionalGroup.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, -2)); - if (f != null) { - writer.writeString( - 1, - f - ); - } -}; - - -/** - * required string id = 1; - * @return {string} - */ -TestGroup.OptionalGroup.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, -2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this - */ -TestGroup.OptionalGroup.prototype.setId = function(value) { - return jspb.Message.setField(this, -2, value); -}; - - -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this - */ -TestGroup.OptionalGroup.prototype.clearId = function() { - return jspb.Message.setField(this, -2, undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestGroup.OptionalGroup.prototype.hasId = function() { - return jspb.Message.getField(this, -2) != null; -}; +TestGroup.RepeatedGroup = class extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, TestGroup.RepeatedGroup.repeatedFields_, null); + }; + /** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ + static repeatedFields_ = [1]; + /** + * required string id = 1; + * @return {string} + */ + getId() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 0, "")); + }; -/** - * repeated group RepeatedGroup = 1; - * @return {!Array} - */ -TestGroup.prototype.getRepeatedGroupList = function() { - return /** @type{!Array} */ ( - jspb.Message.getRepeatedWrapperField(this, TestGroup.RepeatedGroup, 1)); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ + setId(value) { + return jspb.Message.setField(this, 0, value); + }; -/** - * @param {!Array} value - * @return {!proto.jspb.test.TestGroup} returns this -*/ -TestGroup.prototype.setRepeatedGroupList = function(value) { - return jspb.Message.setRepeatedWrapperField(this, 1, value); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ + clearId() { + return jspb.Message.setField(this, 0, undefined); + }; -/** - * @param {!proto.jspb.test.TestGroup.RepeatedGroup=} opt_value - * @param {number=} opt_index - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} - */ -TestGroup.prototype.addRepeatedGroup = function(opt_value, opt_index) { - return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, TestGroup.RepeatedGroup, opt_index); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasId() { + return jspb.Message.getField(this, 0) != null; + }; -/** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.TestGroup} returns this - */ -TestGroup.prototype.clearRepeatedGroupList = function() { - return this.setRepeatedGroupList([]); -}; + /** + * repeated bool some_bool = 2; + * @return {!Array} + */ + getSomeBoolList() { + return /** @type {!Array} */ (jspb.Message.getRepeatedBooleanField(this, 1)); + }; -/** - * required group RequiredGroup = 2; - * @return {!proto.jspb.test.TestGroup.RequiredGroup} - */ -TestGroup.prototype.getRequiredGroup = function() { - return /** @type{!proto.jspb.test.TestGroup.RequiredGroup} */ ( - jspb.Message.getWrapperField(this, TestGroup.RequiredGroup, 2, 1)); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ + setSomeBoolList(value) { + return jspb.Message.setField(this, 1, value || []); + }; -/** - * @param {!proto.jspb.test.TestGroup.RequiredGroup} value - * @return {!proto.jspb.test.TestGroup} returns this -*/ -TestGroup.prototype.setRequiredGroup = function(value) { - return jspb.Message.setWrapperField(this, 2, value); -}; + /** + * @param {boolean} value + * @param {number=} opt_index + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ + addSomeBool(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 1, value, opt_index); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestGroup} returns this - */ -TestGroup.prototype.clearRequiredGroup = function() { - return jspb.Message.setField(this, 2, undefined); -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + */ + clearSomeBoolList() { + return this.setSomeBoolList([]); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestGroup.prototype.hasRequiredGroup = function() { - return jspb.Message.getField(this, 2) != null; -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestGroup.RepeatedGroup; + return TestGroup.RepeatedGroup.deserializeBinaryFromReader(msg, reader); + }; -/** - * optional group OptionalGroup = 3; - * @return {?proto.jspb.test.TestGroup.OptionalGroup} - */ -TestGroup.prototype.getOptionalGroup = function() { - return /** @type{?proto.jspb.test.TestGroup.OptionalGroup} */ ( - jspb.Message.getWrapperField(this, TestGroup.OptionalGroup, 3)); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + case 2: + var values = /** @type {!Array} */ (reader.isDelimited() ? reader.readBool() : [reader.readBool()]); + for (var i = 0; i < values.length; i++) { + msg.addSomeBool(values[i]); + } + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * @param {?proto.jspb.test.TestGroup.OptionalGroup|undefined} value - * @return {!proto.jspb.test.TestGroup} returns this -*/ -TestGroup.prototype.setOptionalGroup = function(value) { - return jspb.Message.setWrapperField(this, 3, value); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestGroup.RepeatedGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Clears the message field making it undefined. - * @return {!proto.jspb.test.TestGroup} returns this - */ -TestGroup.prototype.clearOptionalGroup = function() { - return this.setOptionalGroup(undefined); -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 0)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + f = message.getSomeBoolList(); + if (f.length > 0) { + writer.writeRepeatedBool( + 2, + f + ); + } + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestGroup.prototype.hasOptionalGroup = function() { - return jspb.Message.getField(this, 3) != null; -}; +} -/** - * optional string id = 4; - * @return {string} - */ -TestGroup.prototype.getId = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); -}; +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * @param {string} value - * @return {!proto.jspb.test.TestGroup} returns this + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -TestGroup.prototype.setId = function(value) { - return jspb.Message.setField(this, 4, value); +TestGroup.RepeatedGroup.prototype.toObject = function(opt_includeInstance) { + return TestGroup.RepeatedGroup.toObject(opt_includeInstance, this); }; /** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestGroup} returns this + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestGroup.prototype.clearId = function() { - return jspb.Message.setField(this, 4, undefined); -}; - +TestGroup.RepeatedGroup.toObject = function(includeInstance, msg) { + var f, obj = { +id: (f = jspb.Message.getField(msg, 0)) == null ? undefined : f, +someBoolList: (f = jspb.Message.getRepeatedBooleanField(msg, 1)) == null ? undefined : f + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestGroup.prototype.hasId = function() { - return jspb.Message.getField(this, 4) != null; + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} -/** - * required Simple2 required_simple = 5; - * @return {!proto.jspb.test.Simple2} - */ -TestGroup.prototype.getRequiredSimple = function() { - return /** @type{!proto.jspb.test.Simple2} */ ( - jspb.Message.getWrapperField(this, Simple2, 5, 1)); -}; +TestGroup.RequiredGroup = class extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * required string id = 1; + * @return {string} + */ + getId() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, -1, "")); + }; -/** - * @param {!proto.jspb.test.Simple2} value - * @return {!proto.jspb.test.TestGroup} returns this -*/ -TestGroup.prototype.setRequiredSimple = function(value) { - return jspb.Message.setWrapperField(this, 5, value); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this + */ + setId(value) { + return jspb.Message.setField(this, -1, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestGroup} returns this - */ -TestGroup.prototype.clearRequiredSimple = function() { - return jspb.Message.setField(this, 5, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this + */ + clearId() { + return jspb.Message.setField(this, -1, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestGroup.prototype.hasRequiredSimple = function() { - return jspb.Message.getField(this, 5) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasId() { + return jspb.Message.getField(this, -1) != null; + }; -/** - * optional Simple2 optional_simple = 6; - * @return {?proto.jspb.test.Simple2} - */ -TestGroup.prototype.getOptionalSimple = function() { - return /** @type{?proto.jspb.test.Simple2} */ ( - jspb.Message.getWrapperField(this, Simple2, 6)); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup.RequiredGroup} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestGroup.RequiredGroup; + return TestGroup.RequiredGroup.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {?proto.jspb.test.Simple2|undefined} value - * @return {!proto.jspb.test.TestGroup} returns this -*/ -TestGroup.prototype.setOptionalSimple = function(value) { - return jspb.Message.setWrapperField(this, 6, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup.RequiredGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup.RequiredGroup} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the message field making it undefined. - * @return {!proto.jspb.test.TestGroup} returns this - */ -TestGroup.prototype.clearOptionalSimple = function() { - return this.setOptionalSimple(undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestGroup.RequiredGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestGroup.prototype.hasOptionalSimple = function() { - return jspb.Message.getField(this, 6) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup.RequiredGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, -1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + }; +} @@ -7071,8 +6203,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -TestGroup1.prototype.toObject = function(opt_includeInstance) { - return TestGroup1.toObject(opt_includeInstance, this); +TestGroup.RequiredGroup.prototype.toObject = function(opt_includeInstance) { + return TestGroup.RequiredGroup.toObject(opt_includeInstance, this); }; @@ -7081,13 +6213,13 @@ TestGroup1.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestGroup1} msg The msg instance to transform. + * @param {!proto.jspb.test.TestGroup.RequiredGroup} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestGroup1.toObject = function(includeInstance, msg) { +TestGroup.RequiredGroup.toObject = function(includeInstance, msg) { var f, obj = { -group: (f = msg.getGroup()) && TestGroup.RepeatedGroup.toObject(includeInstance, f) +id: (f = jspb.Message.getField(msg, -1)) == null ? undefined : f }; if (includeInstance) { @@ -7098,114 +6230,126 @@ group: (f = msg.getGroup()) && TestGroup.RepeatedGroup.toObject(includeInstance, } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestGroup1} - */ -TestGroup1.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestGroup1; - return TestGroup1.deserializeBinaryFromReader(msg, reader); -}; +TestGroup.OptionalGroup = class extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * required string id = 1; + * @return {string} + */ + getId() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, -2, "")); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestGroup1} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestGroup1} - */ -TestGroup1.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new TestGroup.RepeatedGroup; - reader.readMessage(value,TestGroup.RepeatedGroup.deserializeBinaryFromReader); - msg.setGroup(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * @param {string} value + * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this + */ + setId(value) { + return jspb.Message.setField(this, -2, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestGroup1.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestGroup1.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this + */ + clearId() { + return jspb.Message.setField(this, -2, undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestGroup1} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestGroup1.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getGroup(); - if (f != null) { - writer.writeMessage( - 1, - f, - TestGroup.RepeatedGroup.serializeBinaryToWriter - ); - } -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasId() { + return jspb.Message.getField(this, -2) != null; + }; -/** - * optional TestGroup.RepeatedGroup group = 1; - * @return {?proto.jspb.test.TestGroup.RepeatedGroup} - */ -TestGroup1.prototype.getGroup = function() { - return /** @type{?proto.jspb.test.TestGroup.RepeatedGroup} */ ( - jspb.Message.getWrapperField(this, TestGroup.RepeatedGroup, 1)); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup.OptionalGroup} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestGroup.OptionalGroup; + return TestGroup.OptionalGroup.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {?proto.jspb.test.TestGroup.RepeatedGroup|undefined} value - * @return {!proto.jspb.test.TestGroup1} returns this -*/ -TestGroup1.prototype.setGroup = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup.OptionalGroup} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup.OptionalGroup} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setId(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the message field making it undefined. - * @return {!proto.jspb.test.TestGroup1} returns this - */ -TestGroup1.prototype.clearGroup = function() { - return this.setGroup(undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestGroup.OptionalGroup.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestGroup1.prototype.hasGroup = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup.OptionalGroup} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, -2)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + }; +} @@ -7222,8 +6366,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -TestReservedNames.prototype.toObject = function(opt_includeInstance) { - return TestReservedNames.toObject(opt_includeInstance, this); +TestGroup.OptionalGroup.prototype.toObject = function(opt_includeInstance) { + return TestGroup.OptionalGroup.toObject(opt_includeInstance, this); }; @@ -7232,18 +6376,15 @@ TestReservedNames.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestReservedNames} msg The msg instance to transform. + * @param {!proto.jspb.test.TestGroup.OptionalGroup} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestReservedNames.toObject = function(includeInstance, msg) { +TestGroup.OptionalGroup.toObject = function(includeInstance, msg) { var f, obj = { -extension: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f +id: (f = jspb.Message.getField(msg, -2)) == null ? undefined : f }; - jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, - TestReservedNames.extensions, TestReservedNames.prototype.getExtension, - includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; } @@ -7252,116 +6393,129 @@ extension: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestReservedNames} - */ -TestReservedNames.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestReservedNames; - return TestReservedNames.deserializeBinaryFromReader(msg, reader); -}; +export class TestGroup1 extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * optional TestGroup.RepeatedGroup group = 1; + * @return {?proto.jspb.test.TestGroup.RepeatedGroup} + */ + getGroup() { + return /** @type{?proto.jspb.test.TestGroup.RepeatedGroup} */ ( + jspb.Message.getWrapperField(this, TestGroup.RepeatedGroup, 1)); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestReservedNames} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestReservedNames} - */ -TestReservedNames.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setExtension$(value); - break; - default: - jspb.Message.readBinaryExtension(msg, reader, - TestReservedNames.extensionsBinary, - TestReservedNames.prototype.getExtension, - TestReservedNames.prototype.setExtension); - break; - } - } - return msg; -}; + /** + * @param {?proto.jspb.test.TestGroup.RepeatedGroup|undefined} value + * @return {!proto.jspb.test.TestGroup1} returns this + */ + setGroup(value) { + return jspb.Message.setWrapperField(this, 1, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestReservedNames.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestReservedNames.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestGroup1} returns this + */ + clearGroup() { + return this.setGroup(undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestReservedNames} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestReservedNames.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeInt32( - 1, - f - ); - } - jspb.Message.serializeBinaryExtensions(message, writer, - TestReservedNames.extensionsBinary, TestReservedNames.prototype.getExtension); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasGroup() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * optional int32 extension = 1; - * @return {number} - */ -TestReservedNames.prototype.getExtension$ = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestGroup1} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestGroup1; + return TestGroup1.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.TestReservedNames} returns this - */ -TestReservedNames.prototype.setExtension$ = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestGroup1} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestGroup1} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new TestGroup.RepeatedGroup; + reader.readMessage(value,TestGroup.RepeatedGroup.deserializeBinaryFromReader); + msg.setGroup(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestReservedNames} returns this - */ -TestReservedNames.prototype.clearExtension$ = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestGroup1.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestReservedNames.prototype.hasExtension$ = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestGroup1} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = message.getGroup(); + if (f != null) { + writer.writeMessage( + 1, + f, + TestGroup.RepeatedGroup.serializeBinaryToWriter + ); + } + }; +} @@ -7378,8 +6532,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -TestReservedNamesExtension.prototype.toObject = function(opt_includeInstance) { - return TestReservedNamesExtension.toObject(opt_includeInstance, this); +TestGroup1.prototype.toObject = function(opt_includeInstance) { + return TestGroup1.toObject(opt_includeInstance, this); }; @@ -7388,13 +6542,13 @@ TestReservedNamesExtension.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestReservedNamesExtension} msg The msg instance to transform. + * @param {!proto.jspb.test.TestGroup1} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestReservedNamesExtension.toObject = function(includeInstance, msg) { +TestGroup1.toObject = function(includeInstance, msg) { var f, obj = { - +group: (f = msg.getGroup()) && TestGroup.RepeatedGroup.toObject(includeInstance, f) }; if (includeInstance) { @@ -7405,195 +6559,293 @@ TestReservedNamesExtension.toObject = function(includeInstance, msg) { } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestReservedNamesExtension} - */ -TestReservedNamesExtension.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestReservedNamesExtension; - return TestReservedNamesExtension.deserializeBinaryFromReader(msg, reader); -}; +export class TestReservedNames extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); + }; + /** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ + static extensions = {}; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestReservedNamesExtension} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestReservedNamesExtension} - */ -TestReservedNamesExtension.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ + static extensionsBinary = {}; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestReservedNamesExtension.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestReservedNamesExtension.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * optional int32 extension = 1; + * @return {number} + */ + getExtension$() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestReservedNamesExtension} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestReservedNamesExtension.serializeBinaryToWriter = function(message, writer) { - var f = undefined; -}; + /** + * @param {number} value + * @return {!proto.jspb.test.TestReservedNames} returns this + */ + setExtension$(value) { + return jspb.Message.setField(this, 1, value); + }; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestReservedNames} returns this + */ + clearExtension$() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * A tuple of {field number, class constructor} for the extension - * field named `foo`. - * @type {!jspb.ExtensionFieldInfo} - */ -TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( - 10, - {foo: 0}, - null, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - null), - 0); -TestReservedNames.extensionsBinary[10] = new jspb.ExtensionFieldBinaryInfo( - TestReservedNamesExtension.foo, - jspb.BinaryReader.prototype.readInt32, - jspb.BinaryWriter.prototype.writeInt32, - undefined, - undefined, - false); -// This registers the extension field with the extended class, so that -// toObject() will function correctly. -TestReservedNames.extensions[10] = TestReservedNamesExtension.foo; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasExtension$() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * A tuple of {field number, class constructor} for the extension - * field named `foo`. - * @type {!jspb.ExtensionFieldInfo} - */ -TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( - 10, - {foo: 0}, - null, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - null), - 0); + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestReservedNames} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestReservedNames; + return TestReservedNames.deserializeBinaryFromReader(msg, reader); + }; -TestReservedNames.extensionsBinary[10] = new jspb.ExtensionFieldBinaryInfo( - TestReservedNamesExtension.foo, - jspb.BinaryReader.prototype.readInt32, - jspb.BinaryWriter.prototype.writeInt32, - undefined, - undefined, - false); -// This registers the extension field with the extended class, so that -// toObject() will function correctly. -TestReservedNames.extensions[10] = TestReservedNamesExtension.foo; + + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestReservedNames} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestReservedNames} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setExtension$(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + TestReservedNames.extensionsBinary, + TestReservedNames.prototype.getExtension, + TestReservedNames.prototype.setExtension); + break; + } + } + return msg; + }; -/** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ -TestMessageWithOneof.repeatedFields_ = [9]; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestReservedNames.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ -TestMessageWithOneof.oneofGroups_ = [[3,5],[6,7],[10,11],[12,13]]; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestReservedNames} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + TestReservedNames.extensionsBinary, TestReservedNames.prototype.getExtension); + }; + + +} + + + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * @enum {number} + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -TestMessageWithOneof.PartialOneofCase = { - PARTIAL_ONEOF_NOT_SET: 0, - PONE: 3, - PTHREE: 5 +TestReservedNames.prototype.toObject = function(opt_includeInstance) { + return TestReservedNames.toObject(opt_includeInstance, this); }; -/** - * @return {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} - */ -TestMessageWithOneof.prototype.getPartialOneofCase = function() { - return /** @type {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[0])); -}; /** - * @enum {number} + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestReservedNames} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestMessageWithOneof.RecursiveOneofCase = { - RECURSIVE_ONEOF_NOT_SET: 0, - RONE: 6, - RTWO: 7 -}; +TestReservedNames.toObject = function(includeInstance, msg) { + var f, obj = { +extension: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f + }; -/** - * @return {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} - */ -TestMessageWithOneof.prototype.getRecursiveOneofCase = function() { - return /** @type {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[1])); + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + TestReservedNames.extensions, TestReservedNames.prototype.getExtension, + includeInstance); + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} -/** - * @enum {number} - */ -TestMessageWithOneof.DefaultOneofACase = { - DEFAULT_ONEOF_A_NOT_SET: 0, - AONE: 10, - ATWO: 11 -}; -/** - * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} - */ -TestMessageWithOneof.prototype.getDefaultOneofACase = function() { - return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[2])); -}; +export class TestReservedNamesExtension extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; -/** - * @enum {number} - */ -TestMessageWithOneof.DefaultOneofBCase = { - DEFAULT_ONEOF_B_NOT_SET: 0, - BONE: 12, - BTWO: 13 -}; + /** + * A tuple of {field number, class constructor} for the extension + * field named `foo`. + * @type {!jspb.ExtensionFieldInfo} + */ + static foo = new jspb.ExtensionFieldInfo( + 10, + {foo: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestReservedNamesExtension} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestReservedNamesExtension; + return TestReservedNamesExtension.deserializeBinaryFromReader(msg, reader); + }; -/** - * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} - */ -TestMessageWithOneof.prototype.getDefaultOneofBCase = function() { - return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[3])); -}; + + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestReservedNamesExtension} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestReservedNamesExtension} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } + } + return msg; + }; + + + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestReservedNamesExtension.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; + + + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestReservedNamesExtension} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + }; + + +} @@ -7610,8 +6862,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -TestMessageWithOneof.prototype.toObject = function(opt_includeInstance) { - return TestMessageWithOneof.toObject(opt_includeInstance, this); +TestReservedNamesExtension.prototype.toObject = function(opt_includeInstance) { + return TestReservedNamesExtension.toObject(opt_includeInstance, this); }; @@ -7620,22 +6872,13 @@ TestMessageWithOneof.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestMessageWithOneof} msg The msg instance to transform. + * @param {!proto.jspb.test.TestReservedNamesExtension} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestMessageWithOneof.toObject = function(includeInstance, msg) { +TestReservedNamesExtension.toObject = function(includeInstance, msg) { var f, obj = { -pone: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, -pthree: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f, -rone: (f = msg.getRone()) && TestMessageWithOneof.toObject(includeInstance, f), -rtwo: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f, -normalField: (f = jspb.Message.getBooleanField(msg, 8)) == null ? undefined : f, -repeatedFieldList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f, -aone: jspb.Message.getFieldWithDefault(msg, 10, 1234), -atwo: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f, -bone: (f = jspb.Message.getField(msg, 12)) == null ? undefined : f, -btwo: jspb.Message.getFieldWithDefault(msg, 13, 1234) + }; if (includeInstance) { @@ -7646,538 +6889,646 @@ btwo: jspb.Message.getFieldWithDefault(msg, 13, 1234) } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestMessageWithOneof} - */ -TestMessageWithOneof.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestMessageWithOneof; - return TestMessageWithOneof.deserializeBinaryFromReader(msg, reader); -}; +TestReservedNames.extensionsBinary[10] = new jspb.ExtensionFieldBinaryInfo( + TestReservedNamesExtension.foo, + jspb.BinaryReader.prototype.readInt32, + jspb.BinaryWriter.prototype.writeInt32, + undefined, + undefined, + false); +// This registers the extension field with the extended class, so that +// toObject() will function correctly. +TestReservedNames.extensions[10] = TestReservedNamesExtension.foo; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestMessageWithOneof} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestMessageWithOneof} - */ -TestMessageWithOneof.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setPone(value); - break; - case 5: - var value = /** @type {string} */ (reader.readString()); - msg.setPthree(value); - break; - case 6: - var value = new TestMessageWithOneof; - reader.readMessage(value,TestMessageWithOneof.deserializeBinaryFromReader); - msg.setRone(value); - break; - case 7: - var value = /** @type {string} */ (reader.readString()); - msg.setRtwo(value); - break; - case 8: - var value = /** @type {boolean} */ (reader.readBool()); - msg.setNormalField(value); - break; - case 9: - var value = /** @type {string} */ (reader.readString()); - msg.addRepeatedField(value); - break; - case 10: - var value = /** @type {number} */ (reader.readInt32()); - msg.setAone(value); - break; - case 11: - var value = /** @type {number} */ (reader.readInt32()); - msg.setAtwo(value); - break; - case 12: - var value = /** @type {number} */ (reader.readInt32()); - msg.setBone(value); - break; - case 13: - var value = /** @type {number} */ (reader.readInt32()); - msg.setBtwo(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; +export class TestMessageWithOneof extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, TestMessageWithOneof.repeatedFields_, TestMessageWithOneof.oneofGroups_); + }; + /** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ + static repeatedFields_ = [9]; + /** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ + static oneofGroups_ = [[3,5],[6,7],[10,11],[12,13]]; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestMessageWithOneof.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestMessageWithOneof.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * @enum {number} + */ + static PartialOneofCase = { + PARTIAL_ONEOF_NOT_SET: 0, + PONE: 3, + PTHREE: 5 + }; + /** + * @return {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} + */ + getPartialOneofCase() { + return /** @type {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[0])); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestMessageWithOneof} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestMessageWithOneof.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 3)); - if (f != null) { - writer.writeString( - 3, - f - ); - } - f = /** @type {string} */ (jspb.Message.getField(message, 5)); - if (f != null) { - writer.writeString( - 5, - f - ); - } - f = message.getRone(); - if (f != null) { - writer.writeMessage( - 6, - f, - TestMessageWithOneof.serializeBinaryToWriter - ); - } - f = /** @type {string} */ (jspb.Message.getField(message, 7)); - if (f != null) { - writer.writeString( - 7, - f - ); - } - f = /** @type {boolean} */ (jspb.Message.getField(message, 8)); - if (f != null) { - writer.writeBool( - 8, - f - ); - } - f = message.getRepeatedFieldList(); - if (f.length > 0) { - writer.writeRepeatedString( - 9, - f - ); - } - f = /** @type {number} */ (jspb.Message.getField(message, 10)); - if (f != null) { - writer.writeInt32( - 10, - f - ); - } - f = /** @type {number} */ (jspb.Message.getField(message, 11)); - if (f != null) { - writer.writeInt32( - 11, - f - ); - } - f = /** @type {number} */ (jspb.Message.getField(message, 12)); - if (f != null) { - writer.writeInt32( - 12, - f - ); - } - f = /** @type {number} */ (jspb.Message.getField(message, 13)); - if (f != null) { - writer.writeInt32( - 13, - f - ); - } -}; + /** + * @enum {number} + */ + static RecursiveOneofCase = { + RECURSIVE_ONEOF_NOT_SET: 0, + RONE: 6, + RTWO: 7 + }; + /** + * @return {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} + */ + getRecursiveOneofCase() { + return /** @type {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[1])); + }; -/** - * optional string pone = 3; - * @return {string} - */ -TestMessageWithOneof.prototype.getPone = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; + /** + * @enum {number} + */ + static DefaultOneofACase = { + DEFAULT_ONEOF_A_NOT_SET: 0, + AONE: 10, + ATWO: 11 + }; + /** + * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} + */ + getDefaultOneofACase() { + return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[2])); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.setPone = function(value) { - return jspb.Message.setOneofField(this, 3, TestMessageWithOneof.oneofGroups_[0], value); -}; + /** + * @enum {number} + */ + static DefaultOneofBCase = { + DEFAULT_ONEOF_B_NOT_SET: 0, + BONE: 12, + BTWO: 13 + }; + /** + * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} + */ + getDefaultOneofBCase() { + return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[3])); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.clearPone = function() { - return jspb.Message.setOneofField(this, 3, TestMessageWithOneof.oneofGroups_[0], undefined); -}; + /** + * optional string pone = 3; + * @return {string} + */ + getPone() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestMessageWithOneof.prototype.hasPone = function() { - return jspb.Message.getField(this, 3) != null; -}; + /** + * @param {string} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + setPone(value) { + return jspb.Message.setOneofField(this, 3, TestMessageWithOneof.oneofGroups_[0], value); + }; -/** - * optional string pthree = 5; - * @return {string} - */ -TestMessageWithOneof.prototype.getPthree = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + clearPone() { + return jspb.Message.setOneofField(this, 3, TestMessageWithOneof.oneofGroups_[0], undefined); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.setPthree = function(value) { - return jspb.Message.setOneofField(this, 5, TestMessageWithOneof.oneofGroups_[0], value); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasPone() { + return jspb.Message.getField(this, 3) != null; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.clearPthree = function() { - return jspb.Message.setOneofField(this, 5, TestMessageWithOneof.oneofGroups_[0], undefined); -}; + /** + * optional string pthree = 5; + * @return {string} + */ + getPthree() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, "")); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestMessageWithOneof.prototype.hasPthree = function() { - return jspb.Message.getField(this, 5) != null; -}; + /** + * @param {string} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + setPthree(value) { + return jspb.Message.setOneofField(this, 5, TestMessageWithOneof.oneofGroups_[0], value); + }; -/** - * optional TestMessageWithOneof rone = 6; - * @return {?proto.jspb.test.TestMessageWithOneof} - */ -TestMessageWithOneof.prototype.getRone = function() { - return /** @type{?proto.jspb.test.TestMessageWithOneof} */ ( - jspb.Message.getWrapperField(this, TestMessageWithOneof, 6)); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + clearPthree() { + return jspb.Message.setOneofField(this, 5, TestMessageWithOneof.oneofGroups_[0], undefined); + }; -/** - * @param {?proto.jspb.test.TestMessageWithOneof|undefined} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this -*/ -TestMessageWithOneof.prototype.setRone = function(value) { - return jspb.Message.setOneofWrapperField(this, 6, TestMessageWithOneof.oneofGroups_[1], value); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasPthree() { + return jspb.Message.getField(this, 5) != null; + }; -/** - * Clears the message field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.clearRone = function() { - return this.setRone(undefined); -}; + /** + * optional TestMessageWithOneof rone = 6; + * @return {?proto.jspb.test.TestMessageWithOneof} + */ + getRone() { + return /** @type{?proto.jspb.test.TestMessageWithOneof} */ ( + jspb.Message.getWrapperField(this, TestMessageWithOneof, 6)); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestMessageWithOneof.prototype.hasRone = function() { - return jspb.Message.getField(this, 6) != null; -}; + /** + * @param {?proto.jspb.test.TestMessageWithOneof|undefined} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + setRone(value) { + return jspb.Message.setOneofWrapperField(this, 6, TestMessageWithOneof.oneofGroups_[1], value); + }; -/** - * optional string rtwo = 7; - * @return {string} - */ -TestMessageWithOneof.prototype.getRtwo = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); -}; + /** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + clearRone() { + return this.setRone(undefined); + }; + + + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasRone() { + return jspb.Message.getField(this, 6) != null; + }; + + + /** + * optional string rtwo = 7; + * @return {string} + */ + getRtwo() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, "")); + }; + + + /** + * @param {string} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + setRtwo(value) { + return jspb.Message.setOneofField(this, 7, TestMessageWithOneof.oneofGroups_[1], value); + }; + + + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + clearRtwo() { + return jspb.Message.setOneofField(this, 7, TestMessageWithOneof.oneofGroups_[1], undefined); + }; + + + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasRtwo() { + return jspb.Message.getField(this, 7) != null; + }; + + /** + * optional bool normal_field = 8; + * @return {boolean} + */ + getNormalField() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.setRtwo = function(value) { - return jspb.Message.setOneofField(this, 7, TestMessageWithOneof.oneofGroups_[1], value); -}; + /** + * @param {boolean} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + setNormalField(value) { + return jspb.Message.setField(this, 8, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.clearRtwo = function() { - return jspb.Message.setOneofField(this, 7, TestMessageWithOneof.oneofGroups_[1], undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + clearNormalField() { + return jspb.Message.setField(this, 8, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestMessageWithOneof.prototype.hasRtwo = function() { - return jspb.Message.getField(this, 7) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasNormalField() { + return jspb.Message.getField(this, 8) != null; + }; -/** - * optional bool normal_field = 8; - * @return {boolean} - */ -TestMessageWithOneof.prototype.getNormalField = function() { - return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 8, false)); -}; + /** + * repeated string repeated_field = 9; + * @return {!Array} + */ + getRepeatedFieldList() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 9)); + }; -/** - * @param {boolean} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.setNormalField = function(value) { - return jspb.Message.setField(this, 8, value); -}; + /** + * @param {!Array} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + setRepeatedFieldList(value) { + return jspb.Message.setField(this, 9, value || []); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.clearNormalField = function() { - return jspb.Message.setField(this, 8, undefined); -}; + /** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + addRepeatedField(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 9, value, opt_index); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestMessageWithOneof.prototype.hasNormalField = function() { - return jspb.Message.getField(this, 8) != null; -}; + /** + * Clears the list making it empty but non-null. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + clearRepeatedFieldList() { + return this.setRepeatedFieldList([]); + }; -/** - * repeated string repeated_field = 9; - * @return {!Array} - */ -TestMessageWithOneof.prototype.getRepeatedFieldList = function() { - return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 9)); -}; + /** + * optional int32 aone = 10; + * @return {number} + */ + getAone() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 10, 1234)); + }; -/** - * @param {!Array} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.setRepeatedFieldList = function(value) { - return jspb.Message.setField(this, 9, value || []); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + setAone(value) { + return jspb.Message.setOneofField(this, 10, TestMessageWithOneof.oneofGroups_[2], value); + }; -/** - * @param {string} value - * @param {number=} opt_index - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.addRepeatedField = function(value, opt_index) { - return jspb.Message.addToRepeatedField(this, 9, value, opt_index); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + clearAone() { + return jspb.Message.setOneofField(this, 10, TestMessageWithOneof.oneofGroups_[2], undefined); + }; -/** - * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.clearRepeatedFieldList = function() { - return this.setRepeatedFieldList([]); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasAone() { + return jspb.Message.getField(this, 10) != null; + }; -/** - * optional int32 aone = 10; - * @return {number} - */ -TestMessageWithOneof.prototype.getAone = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 10, 1234)); -}; + /** + * optional int32 atwo = 11; + * @return {number} + */ + getAtwo() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.setAone = function(value) { - return jspb.Message.setOneofField(this, 10, TestMessageWithOneof.oneofGroups_[2], value); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + setAtwo(value) { + return jspb.Message.setOneofField(this, 11, TestMessageWithOneof.oneofGroups_[2], value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.clearAone = function() { - return jspb.Message.setOneofField(this, 10, TestMessageWithOneof.oneofGroups_[2], undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + clearAtwo() { + return jspb.Message.setOneofField(this, 11, TestMessageWithOneof.oneofGroups_[2], undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestMessageWithOneof.prototype.hasAone = function() { - return jspb.Message.getField(this, 10) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasAtwo() { + return jspb.Message.getField(this, 11) != null; + }; -/** - * optional int32 atwo = 11; - * @return {number} - */ -TestMessageWithOneof.prototype.getAtwo = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 11, 0)); -}; + /** + * optional int32 bone = 12; + * @return {number} + */ + getBone() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 12, 0)); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.setAtwo = function(value) { - return jspb.Message.setOneofField(this, 11, TestMessageWithOneof.oneofGroups_[2], value); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + setBone(value) { + return jspb.Message.setOneofField(this, 12, TestMessageWithOneof.oneofGroups_[3], value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.clearAtwo = function() { - return jspb.Message.setOneofField(this, 11, TestMessageWithOneof.oneofGroups_[2], undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + clearBone() { + return jspb.Message.setOneofField(this, 12, TestMessageWithOneof.oneofGroups_[3], undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestMessageWithOneof.prototype.hasAtwo = function() { - return jspb.Message.getField(this, 11) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasBone() { + return jspb.Message.getField(this, 12) != null; + }; -/** - * optional int32 bone = 12; - * @return {number} - */ -TestMessageWithOneof.prototype.getBone = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 12, 0)); -}; + /** + * optional int32 btwo = 13; + * @return {number} + */ + getBtwo() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 1234)); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.setBone = function(value) { - return jspb.Message.setOneofField(this, 12, TestMessageWithOneof.oneofGroups_[3], value); -}; + + /** + * @param {number} value + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + setBtwo(value) { + return jspb.Message.setOneofField(this, 13, TestMessageWithOneof.oneofGroups_[3], value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.clearBone = function() { - return jspb.Message.setOneofField(this, 12, TestMessageWithOneof.oneofGroups_[3], undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestMessageWithOneof} returns this + */ + clearBtwo() { + return jspb.Message.setOneofField(this, 13, TestMessageWithOneof.oneofGroups_[3], undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestMessageWithOneof.prototype.hasBone = function() { - return jspb.Message.getField(this, 12) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasBtwo() { + return jspb.Message.getField(this, 13) != null; + }; -/** - * optional int32 btwo = 13; - * @return {number} - */ -TestMessageWithOneof.prototype.getBtwo = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 13, 1234)); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestMessageWithOneof} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestMessageWithOneof; + return TestMessageWithOneof.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.setBtwo = function(value) { - return jspb.Message.setOneofField(this, 13, TestMessageWithOneof.oneofGroups_[3], value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestMessageWithOneof} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestMessageWithOneof} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setPone(value); + break; + case 5: + var value = /** @type {string} */ (reader.readString()); + msg.setPthree(value); + break; + case 6: + var value = new TestMessageWithOneof; + reader.readMessage(value,TestMessageWithOneof.deserializeBinaryFromReader); + msg.setRone(value); + break; + case 7: + var value = /** @type {string} */ (reader.readString()); + msg.setRtwo(value); + break; + case 8: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setNormalField(value); + break; + case 9: + var value = /** @type {string} */ (reader.readString()); + msg.addRepeatedField(value); + break; + case 10: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAone(value); + break; + case 11: + var value = /** @type {number} */ (reader.readInt32()); + msg.setAtwo(value); + break; + case 12: + var value = /** @type {number} */ (reader.readInt32()); + msg.setBone(value); + break; + case 13: + var value = /** @type {number} */ (reader.readInt32()); + msg.setBtwo(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this - */ -TestMessageWithOneof.prototype.clearBtwo = function() { - return jspb.Message.setOneofField(this, 13, TestMessageWithOneof.oneofGroups_[3], undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestMessageWithOneof.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestMessageWithOneof.prototype.hasBtwo = function() { - return jspb.Message.getField(this, 13) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestMessageWithOneof} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeString( + 3, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 5)); + if (f != null) { + writer.writeString( + 5, + f + ); + } + f = message.getRone(); + if (f != null) { + writer.writeMessage( + 6, + f, + TestMessageWithOneof.serializeBinaryToWriter + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 7)); + if (f != null) { + writer.writeString( + 7, + f + ); + } + f = /** @type {boolean} */ (jspb.Message.getField(message, 8)); + if (f != null) { + writer.writeBool( + 8, + f + ); + } + f = message.getRepeatedFieldList(); + if (f.length > 0) { + writer.writeRepeatedString( + 9, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 10)); + if (f != null) { + writer.writeInt32( + 10, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 11)); + if (f != null) { + writer.writeInt32( + 11, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 12)); + if (f != null) { + writer.writeInt32( + 12, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 13)); + if (f != null) { + writer.writeInt32( + 13, + f + ); + } + }; +} @@ -8194,8 +7545,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -TestEndsWithBytes.prototype.toObject = function(opt_includeInstance) { - return TestEndsWithBytes.toObject(opt_includeInstance, this); +TestMessageWithOneof.prototype.toObject = function(opt_includeInstance) { + return TestMessageWithOneof.toObject(opt_includeInstance, this); }; @@ -8204,14 +7555,22 @@ TestEndsWithBytes.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestEndsWithBytes} msg The msg instance to transform. + * @param {!proto.jspb.test.TestMessageWithOneof} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestEndsWithBytes.toObject = function(includeInstance, msg) { +TestMessageWithOneof.toObject = function(includeInstance, msg) { var f, obj = { -value: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, -data: msg.getData_asB64() +pone: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f, +pthree: (f = jspb.Message.getField(msg, 5)) == null ? undefined : f, +rone: (f = msg.getRone()) && TestMessageWithOneof.toObject(includeInstance, f), +rtwo: (f = jspb.Message.getField(msg, 7)) == null ? undefined : f, +normalField: (f = jspb.Message.getBooleanField(msg, 8)) == null ? undefined : f, +repeatedFieldList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f, +aone: jspb.Message.getFieldWithDefault(msg, 10, 1234), +atwo: (f = jspb.Message.getField(msg, 11)) == null ? undefined : f, +bone: (f = jspb.Message.getField(msg, 12)) == null ? undefined : f, +btwo: jspb.Message.getFieldWithDefault(msg, 13, 1234) }; if (includeInstance) { @@ -8222,182 +7581,197 @@ data: msg.getData_asB64() } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestEndsWithBytes} - */ -TestEndsWithBytes.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestEndsWithBytes; - return TestEndsWithBytes.deserializeBinaryFromReader(msg, reader); -}; +export class TestEndsWithBytes extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * optional int32 value = 1; + * @return {number} + */ + getValue() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestEndsWithBytes} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestEndsWithBytes} - */ -TestEndsWithBytes.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setValue(value); - break; - case 2: - var value = /** @type {!Uint8Array} */ (reader.readBytes()); - msg.setData(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * @param {number} value + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ + setValue(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestEndsWithBytes.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestEndsWithBytes.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ + clearValue() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestEndsWithBytes} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestEndsWithBytes.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeInt32( - 1, - f - ); - } - f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2)); - if (f != null) { - writer.writeBytes( - 2, - f - ); - } -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasValue() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * optional int32 value = 1; - * @return {number} - */ -TestEndsWithBytes.prototype.getValue = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; + /** + * optional bytes data = 2; + * @return {!(string|Uint8Array)} + */ + getData() { + return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.TestEndsWithBytes} returns this - */ -TestEndsWithBytes.prototype.setValue = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * optional bytes data = 2; + * This is a type-conversion wrapper around `getData()` + * @return {string} + */ + getData_asB64() { + return /** @type {string} */ (jspb.Message.bytesAsB64( + this.getData())); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestEndsWithBytes} returns this - */ -TestEndsWithBytes.prototype.clearValue = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * optional bytes data = 2; + * Note that Uint8Array is not supported on all browsers. + * @see http://caniuse.com/Uint8Array + * This is a type-conversion wrapper around `getData()` + * @return {!Uint8Array} + */ + getData_asU8() { + return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( + this.getData())); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestEndsWithBytes.prototype.hasValue = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * @param {!(string|Uint8Array)} value + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ + setData(value) { + return jspb.Message.setField(this, 2, value); + }; -/** - * optional bytes data = 2; - * @return {!(string|Uint8Array)} - */ -TestEndsWithBytes.prototype.getData = function() { - return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestEndsWithBytes} returns this + */ + clearData() { + return jspb.Message.setField(this, 2, undefined); + }; -/** - * optional bytes data = 2; - * This is a type-conversion wrapper around `getData()` - * @return {string} - */ -TestEndsWithBytes.prototype.getData_asB64 = function() { - return /** @type {string} */ (jspb.Message.bytesAsB64( - this.getData())); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasData() { + return jspb.Message.getField(this, 2) != null; + }; -/** - * optional bytes data = 2; - * Note that Uint8Array is not supported on all browsers. - * @see http://caniuse.com/Uint8Array - * This is a type-conversion wrapper around `getData()` - * @return {!Uint8Array} - */ -TestEndsWithBytes.prototype.getData_asU8 = function() { - return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8( - this.getData())); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestEndsWithBytes} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestEndsWithBytes; + return TestEndsWithBytes.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {!(string|Uint8Array)} value - * @return {!proto.jspb.test.TestEndsWithBytes} returns this - */ -TestEndsWithBytes.prototype.setData = function(value) { - return jspb.Message.setField(this, 2, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestEndsWithBytes} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestEndsWithBytes} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setValue(value); + break; + case 2: + var value = /** @type {!Uint8Array} */ (reader.readBytes()); + msg.setData(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestEndsWithBytes} returns this - */ -TestEndsWithBytes.prototype.clearData = function() { - return jspb.Message.setField(this, 2, undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestEndsWithBytes.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestEndsWithBytes.prototype.hasData = function() { - return jspb.Message.getField(this, 2) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestEndsWithBytes} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeBytes( + 2, + f + ); + } + }; +} @@ -8414,8 +7788,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -TestLastFieldBeforePivot.prototype.toObject = function(opt_includeInstance) { - return TestLastFieldBeforePivot.toObject(opt_includeInstance, this); +TestEndsWithBytes.prototype.toObject = function(opt_includeInstance) { + return TestEndsWithBytes.toObject(opt_includeInstance, this); }; @@ -8424,18 +7798,16 @@ TestLastFieldBeforePivot.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestLastFieldBeforePivot} msg The msg instance to transform. + * @param {!proto.jspb.test.TestEndsWithBytes} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestLastFieldBeforePivot.toObject = function(includeInstance, msg) { +TestEndsWithBytes.toObject = function(includeInstance, msg) { var f, obj = { -lastFieldBeforePivot: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f +value: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +data: msg.getData_asB64() }; - jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, - TestLastFieldBeforePivot.extensions, TestLastFieldBeforePivot.prototype.getExtension, - includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; } @@ -8444,116 +7816,161 @@ lastFieldBeforePivot: (f = jspb.Message.getField(msg, 1)) == null ? undefined : } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestLastFieldBeforePivot} - */ -TestLastFieldBeforePivot.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestLastFieldBeforePivot; - return TestLastFieldBeforePivot.deserializeBinaryFromReader(msg, reader); -}; +export class TestLastFieldBeforePivot extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); + }; + /** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ + static extensions = {}; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestLastFieldBeforePivot} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestLastFieldBeforePivot} - */ -TestLastFieldBeforePivot.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setLastFieldBeforePivot(value); - break; - default: - jspb.Message.readBinaryExtension(msg, reader, - TestLastFieldBeforePivot.extensionsBinary, - TestLastFieldBeforePivot.prototype.getExtension, - TestLastFieldBeforePivot.prototype.setExtension); - break; - } - } - return msg; -}; + /** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ + static extensionsBinary = {}; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestLastFieldBeforePivot.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestLastFieldBeforePivot.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * optional int32 last_field_before_pivot = 1; + * @return {number} + */ + getLastFieldBeforePivot() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestLastFieldBeforePivot} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestLastFieldBeforePivot.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeInt32( - 1, - f - ); - } - jspb.Message.serializeBinaryExtensions(message, writer, - TestLastFieldBeforePivot.extensionsBinary, TestLastFieldBeforePivot.prototype.getExtension); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this + */ + setLastFieldBeforePivot(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * optional int32 last_field_before_pivot = 1; - * @return {number} - */ -TestLastFieldBeforePivot.prototype.getLastFieldBeforePivot = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this + */ + clearLastFieldBeforePivot() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this - */ -TestLastFieldBeforePivot.prototype.setLastFieldBeforePivot = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasLastFieldBeforePivot() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this - */ -TestLastFieldBeforePivot.prototype.clearLastFieldBeforePivot = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestLastFieldBeforePivot} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestLastFieldBeforePivot; + return TestLastFieldBeforePivot.deserializeBinaryFromReader(msg, reader); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestLastFieldBeforePivot.prototype.hasLastFieldBeforePivot = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestLastFieldBeforePivot} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestLastFieldBeforePivot} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setLastFieldBeforePivot(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + TestLastFieldBeforePivot.extensionsBinary, + TestLastFieldBeforePivot.prototype.getExtension, + TestLastFieldBeforePivot.prototype.setExtension); + break; + } + } + return msg; + }; + + + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestLastFieldBeforePivot.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; + + + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestLastFieldBeforePivot} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + TestLastFieldBeforePivot.extensionsBinary, TestLastFieldBeforePivot.prototype.getExtension); + }; +} @@ -8570,8 +7987,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -Int64Types.prototype.toObject = function(opt_includeInstance) { - return Int64Types.toObject(opt_includeInstance, this); +TestLastFieldBeforePivot.prototype.toObject = function(opt_includeInstance) { + return TestLastFieldBeforePivot.toObject(opt_includeInstance, this); }; @@ -8580,17 +7997,18 @@ Int64Types.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Int64Types} msg The msg instance to transform. + * @param {!proto.jspb.test.TestLastFieldBeforePivot} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -Int64Types.toObject = function(includeInstance, msg) { +TestLastFieldBeforePivot.toObject = function(includeInstance, msg) { var f, obj = { -int64Normal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, -int64String: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, -int64Number: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f +lastFieldBeforePivot: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f }; + jspb.Message.toObjectExtension(/** @type {!jspb.Message} */ (msg), obj, + TestLastFieldBeforePivot.extensions, TestLastFieldBeforePivot.prototype.getExtension, + includeInstance); if (includeInstance) { obj.$jspbMessageInstance = msg; } @@ -8599,205 +8017,220 @@ int64Number: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Int64Types} - */ -Int64Types.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new Int64Types; - return Int64Types.deserializeBinaryFromReader(msg, reader); -}; +export class Int64Types extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * optional int64 int64_normal = 1; + * @return {number} + */ + getInt64Normal() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.Int64Types} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Int64Types} - */ -Int64Types.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt64()); - msg.setInt64Normal(value); - break; - case 2: - var value = /** @type {string} */ (reader.readSint64String()); - msg.setInt64String(value); - break; - case 3: - var value = /** @type {number} */ (reader.readUint64()); - msg.setInt64Number(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * @param {number} value + * @return {!proto.jspb.test.Int64Types} returns this + */ + setInt64Normal(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -Int64Types.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - Int64Types.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Int64Types} returns this + */ + clearInt64Normal() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Int64Types} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -Int64Types.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeInt64( - 1, - f - ); - } - f = /** @type {string} */ (jspb.Message.getField(message, 2)); - if (f != null) { - writer.writeSint64String( - 2, - f - ); - } - f = /** @type {number} */ (jspb.Message.getField(message, 3)); - if (f != null) { - writer.writeUint64( - 3, - f - ); - } -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasInt64Normal() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * optional int64 int64_normal = 1; - * @return {number} - */ -Int64Types.prototype.getInt64Normal = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; + /** + * optional sint64 int64_string = 2; + * @return {string} + */ + getInt64String() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.Int64Types} returns this - */ -Int64Types.prototype.setInt64Normal = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * @param {string} value + * @return {!proto.jspb.test.Int64Types} returns this + */ + setInt64String(value) { + return jspb.Message.setField(this, 2, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.Int64Types} returns this - */ -Int64Types.prototype.clearInt64Normal = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Int64Types} returns this + */ + clearInt64String() { + return jspb.Message.setField(this, 2, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -Int64Types.prototype.hasInt64Normal = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasInt64String() { + return jspb.Message.getField(this, 2) != null; + }; -/** - * optional sint64 int64_string = 2; - * @return {string} - */ -Int64Types.prototype.getInt64String = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "0")); -}; + /** + * optional uint64 int64_number = 3; + * @return {number} + */ + getInt64Number() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.Int64Types} returns this - */ -Int64Types.prototype.setInt64String = function(value) { - return jspb.Message.setField(this, 2, value); -}; + /** + * @param {number} value + * @return {!proto.jspb.test.Int64Types} returns this + */ + setInt64Number(value) { + return jspb.Message.setField(this, 3, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.Int64Types} returns this - */ -Int64Types.prototype.clearInt64String = function() { - return jspb.Message.setField(this, 2, undefined); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Int64Types} returns this + */ + clearInt64Number() { + return jspb.Message.setField(this, 3, undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -Int64Types.prototype.hasInt64String = function() { - return jspb.Message.getField(this, 2) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasInt64Number() { + return jspb.Message.getField(this, 3) != null; + }; -/** - * optional uint64 int64_number = 3; - * @return {number} - */ -Int64Types.prototype.getInt64Number = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0)); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Int64Types} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new Int64Types; + return Int64Types.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.Int64Types} returns this - */ -Int64Types.prototype.setInt64Number = function(value) { - return jspb.Message.setField(this, 3, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Int64Types} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Int64Types} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt64()); + msg.setInt64Normal(value); + break; + case 2: + var value = /** @type {string} */ (reader.readSint64String()); + msg.setInt64String(value); + break; + case 3: + var value = /** @type {number} */ (reader.readUint64()); + msg.setInt64Number(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.Int64Types} returns this - */ -Int64Types.prototype.clearInt64Number = function() { - return jspb.Message.setField(this, 3, undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + Int64Types.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -Int64Types.prototype.hasInt64Number = function() { - return jspb.Message.getField(this, 3) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Int64Types} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt64( + 1, + f + ); + } + f = /** @type {string} */ (jspb.Message.getField(message, 2)); + if (f != null) { + writer.writeSint64String( + 2, + f + ); + } + f = /** @type {number} */ (jspb.Message.getField(message, 3)); + if (f != null) { + writer.writeUint64( + 3, + f + ); + } + }; +} @@ -8814,8 +8247,8 @@ if (jspb.Message.GENERATE_TO_OBJECT) { * http://goto/soy-param-migration * @return {!Object} */ -TestMapFieldsNoBinary.prototype.toObject = function(opt_includeInstance) { - return TestMapFieldsNoBinary.toObject(opt_includeInstance, this); +Int64Types.prototype.toObject = function(opt_includeInstance) { + return Int64Types.toObject(opt_includeInstance, this); }; @@ -8824,24 +8257,15 @@ TestMapFieldsNoBinary.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestMapFieldsNoBinary} msg The msg instance to transform. + * @param {!proto.jspb.test.Int64Types} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestMapFieldsNoBinary.toObject = function(includeInstance, msg) { +Int64Types.toObject = function(includeInstance, msg) { var f, obj = { -mapStringStringMap: (f = msg.getMapStringStringMap()) ? f.toObject(includeInstance, undefined) : [], -mapStringInt32Map: (f = msg.getMapStringInt32Map()) ? f.toObject(includeInstance, undefined) : [], -mapStringInt64Map: (f = msg.getMapStringInt64Map()) ? f.toObject(includeInstance, undefined) : [], -mapStringBoolMap: (f = msg.getMapStringBoolMap()) ? f.toObject(includeInstance, undefined) : [], -mapStringDoubleMap: (f = msg.getMapStringDoubleMap()) ? f.toObject(includeInstance, undefined) : [], -mapStringEnumMap: (f = msg.getMapStringEnumMap()) ? f.toObject(includeInstance, undefined) : [], -mapStringMsgMap: (f = msg.getMapStringMsgMap()) ? f.toObject(includeInstance, MapValueMessageNoBinary.toObject) : [], -mapInt32StringMap: (f = msg.getMapInt32StringMap()) ? f.toObject(includeInstance, undefined) : [], -mapInt64StringMap: (f = msg.getMapInt64StringMap()) ? f.toObject(includeInstance, undefined) : [], -mapBoolStringMap: (f = msg.getMapBoolStringMap()) ? f.toObject(includeInstance, undefined) : [], -testMapFields: (f = msg.getTestMapFields()) && TestMapFieldsNoBinary.toObject(includeInstance, f), -mapStringTestmapfieldsMap: (f = msg.getMapStringTestmapfieldsMap()) ? f.toObject(includeInstance, TestMapFieldsNoBinary.toObject) : [] +int64Normal: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f, +int64String: (f = jspb.Message.getField(msg, 2)) == null ? undefined : f, +int64Number: (f = jspb.Message.getField(msg, 3)) == null ? undefined : f }; if (includeInstance) { @@ -8852,477 +8276,666 @@ mapStringTestmapfieldsMap: (f = msg.getMapStringTestmapfieldsMap()) ? f.toObject } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} - */ -TestMapFieldsNoBinary.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestMapFieldsNoBinary; - return TestMapFieldsNoBinary.deserializeBinaryFromReader(msg, reader); -}; +export class TestMapFieldsNoBinary extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * map map_string_string = 1; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ + getMapStringStringMap(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 1, opt_noLazyCreate, + null)); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestMapFieldsNoBinary} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} - */ -TestMapFieldsNoBinary.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = msg.getMapStringStringMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); - }); - break; - case 2: - var value = msg.getMapStringInt32Map(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt32, null, "", 0); - }); - break; - case 3: - var value = msg.getMapStringInt64Map(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt64, null, "", 0); - }); - break; - case 4: - var value = msg.getMapStringBoolMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readBool, null, "", false); - }); - break; - case 5: - var value = msg.getMapStringDoubleMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readDouble, null, "", 0.0); - }); - break; - case 6: - var value = msg.getMapStringEnumMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readEnum, null, "", 0); - }); - break; - case 7: - var value = msg.getMapStringMsgMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, MapValueMessageNoBinary.deserializeBinaryFromReader, "", new MapValueMessageNoBinary()); - }); - break; - case 8: - var value = msg.getMapInt32StringMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt32, jspb.BinaryReader.prototype.readString, null, 0, ""); - }); - break; - case 9: - var value = msg.getMapInt64StringMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt64, jspb.BinaryReader.prototype.readString, null, 0, ""); - }); - break; - case 10: - var value = msg.getMapBoolStringMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readBool, jspb.BinaryReader.prototype.readString, null, false, ""); - }); - break; - case 11: - var value = new TestMapFieldsNoBinary; - reader.readMessage(value,TestMapFieldsNoBinary.deserializeBinaryFromReader); - msg.setTestMapFields(value); - break; - case 12: - var value = msg.getMapStringTestmapfieldsMap(); - reader.readMessage(value, function(message, reader) { - jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, TestMapFieldsNoBinary.deserializeBinaryFromReader, "", new TestMapFieldsNoBinary()); - }); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; + /** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + clearMapStringStringMapfunction() { + this.getMapStringStringMap().clear(); + return this; + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestMapFieldsNoBinary.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestMapFieldsNoBinary.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * map map_string_int32 = 2; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ + getMapStringInt32Map(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 2, opt_noLazyCreate, + null)); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestMapFieldsNoBinary} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestMapFieldsNoBinary.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getMapStringStringMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); - } - f = message.getMapStringInt32Map(true); - if (f && f.getLength() > 0) { - f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt32); - } - f = message.getMapStringInt64Map(true); - if (f && f.getLength() > 0) { - f.serializeBinary(3, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt64); - } - f = message.getMapStringBoolMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(4, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeBool); - } - f = message.getMapStringDoubleMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(5, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeDouble); - } - f = message.getMapStringEnumMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(6, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeEnum); - } - f = message.getMapStringMsgMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(7, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, MapValueMessageNoBinary.serializeBinaryToWriter); - } - f = message.getMapInt32StringMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(8, writer, jspb.BinaryWriter.prototype.writeInt32, jspb.BinaryWriter.prototype.writeString); - } - f = message.getMapInt64StringMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(9, writer, jspb.BinaryWriter.prototype.writeInt64, jspb.BinaryWriter.prototype.writeString); - } - f = message.getMapBoolStringMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(10, writer, jspb.BinaryWriter.prototype.writeBool, jspb.BinaryWriter.prototype.writeString); - } - f = message.getTestMapFields(); - if (f != null) { - writer.writeMessage( - 11, - f, - TestMapFieldsNoBinary.serializeBinaryToWriter - ); - } - f = message.getMapStringTestmapfieldsMap(true); - if (f && f.getLength() > 0) { - f.serializeBinary(12, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, TestMapFieldsNoBinary.serializeBinaryToWriter); - } -}; + /** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + clearMapStringInt32Mapfunction() { + this.getMapStringInt32Map().clear(); + return this; + }; -/** - * map map_string_string = 1; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -TestMapFieldsNoBinary.prototype.getMapStringStringMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 1, opt_noLazyCreate, - null)); -}; + /** + * map map_string_int64 = 3; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ + getMapStringInt64Map(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 3, opt_noLazyCreate, + null)); + }; -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this - */ -TestMapFieldsNoBinary.prototype.clearMapStringStringMap = function() { - this.getMapStringStringMap().clear(); - return this; -}; + /** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + clearMapStringInt64Mapfunction() { + this.getMapStringInt64Map().clear(); + return this; + }; -/** - * map map_string_int32 = 2; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -TestMapFieldsNoBinary.prototype.getMapStringInt32Map = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 2, opt_noLazyCreate, - null)); -}; + /** + * map map_string_bool = 4; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ + getMapStringBoolMap(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 4, opt_noLazyCreate, + null)); + }; -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this - */ -TestMapFieldsNoBinary.prototype.clearMapStringInt32Map = function() { - this.getMapStringInt32Map().clear(); - return this; -}; + /** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + clearMapStringBoolMapfunction() { + this.getMapStringBoolMap().clear(); + return this; + }; -/** - * map map_string_int64 = 3; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -TestMapFieldsNoBinary.prototype.getMapStringInt64Map = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 3, opt_noLazyCreate, - null)); -}; + /** + * map map_string_double = 5; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ + getMapStringDoubleMap(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 5, opt_noLazyCreate, + null)); + }; -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this - */ -TestMapFieldsNoBinary.prototype.clearMapStringInt64Map = function() { - this.getMapStringInt64Map().clear(); - return this; -}; + /** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + clearMapStringDoubleMapfunction() { + this.getMapStringDoubleMap().clear(); + return this; + }; -/** - * map map_string_bool = 4; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -TestMapFieldsNoBinary.prototype.getMapStringBoolMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 4, opt_noLazyCreate, - null)); -}; + /** + * map map_string_enum = 6; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ + getMapStringEnumMap(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 6, opt_noLazyCreate, + null)); + }; -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this - */ -TestMapFieldsNoBinary.prototype.clearMapStringBoolMap = function() { - this.getMapStringBoolMap().clear(); - return this; -}; + /** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + clearMapStringEnumMapfunction() { + this.getMapStringEnumMap().clear(); + return this; + }; -/** - * map map_string_double = 5; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -TestMapFieldsNoBinary.prototype.getMapStringDoubleMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 5, opt_noLazyCreate, - null)); -}; + /** + * map map_string_msg = 7; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ + getMapStringMsgMap(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 7, opt_noLazyCreate, + MapValueMessageNoBinary)); + }; -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this - */ -TestMapFieldsNoBinary.prototype.clearMapStringDoubleMap = function() { - this.getMapStringDoubleMap().clear(); - return this; -}; + /** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + clearMapStringMsgMapfunction() { + this.getMapStringMsgMap().clear(); + return this; + }; -/** - * map map_string_enum = 6; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -TestMapFieldsNoBinary.prototype.getMapStringEnumMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 6, opt_noLazyCreate, - null)); -}; + /** + * map map_int32_string = 8; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ + getMapInt32StringMap(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 8, opt_noLazyCreate, + null)); + }; -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this - */ -TestMapFieldsNoBinary.prototype.clearMapStringEnumMap = function() { - this.getMapStringEnumMap().clear(); - return this; -}; + /** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + clearMapInt32StringMapfunction() { + this.getMapInt32StringMap().clear(); + return this; + }; -/** - * map map_string_msg = 7; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -TestMapFieldsNoBinary.prototype.getMapStringMsgMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 7, opt_noLazyCreate, - MapValueMessageNoBinary)); -}; + /** + * map map_int64_string = 9; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ + getMapInt64StringMap(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 9, opt_noLazyCreate, + null)); + }; -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this - */ -TestMapFieldsNoBinary.prototype.clearMapStringMsgMap = function() { - this.getMapStringMsgMap().clear(); - return this; -}; + /** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + clearMapInt64StringMapfunction() { + this.getMapInt64StringMap().clear(); + return this; + }; -/** - * map map_int32_string = 8; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -TestMapFieldsNoBinary.prototype.getMapInt32StringMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 8, opt_noLazyCreate, - null)); -}; + /** + * map map_bool_string = 10; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ + getMapBoolStringMap(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 10, opt_noLazyCreate, + null)); + }; + + + /** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + clearMapBoolStringMapfunction() { + this.getMapBoolStringMap().clear(); + return this; + }; + + + /** + * optional TestMapFieldsNoBinary test_map_fields = 11; + * @return {?proto.jspb.test.TestMapFieldsNoBinary} + */ + getTestMapFields() { + return /** @type{?proto.jspb.test.TestMapFieldsNoBinary} */ ( + jspb.Message.getWrapperField(this, TestMapFieldsNoBinary, 11)); + }; + + + /** + * @param {?proto.jspb.test.TestMapFieldsNoBinary|undefined} value + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + setTestMapFields(value) { + return jspb.Message.setWrapperField(this, 11, value); + }; + + + /** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + clearTestMapFields() { + return this.setTestMapFields(undefined); + }; + + + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasTestMapFields() { + return jspb.Message.getField(this, 11) != null; + }; + + + /** + * map map_string_testmapfields = 12; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ + getMapStringTestmapfieldsMap(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 12, opt_noLazyCreate, + TestMapFieldsNoBinary)); + }; + + + /** + * Clears values from the map. The map will be non-null. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + */ + clearMapStringTestmapfieldsMapfunction() { + this.getMapStringTestmapfieldsMap().clear(); + return this; + }; + + + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestMapFieldsNoBinary; + return TestMapFieldsNoBinary.deserializeBinaryFromReader(msg, reader); + }; + + + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestMapFieldsNoBinary} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestMapFieldsNoBinary} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = msg.getMapStringStringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); + }); + break; + case 2: + var value = msg.getMapStringInt32Map(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt32, null, "", 0); + }); + break; + case 3: + var value = msg.getMapStringInt64Map(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readInt64, null, "", 0); + }); + break; + case 4: + var value = msg.getMapStringBoolMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readBool, null, "", false); + }); + break; + case 5: + var value = msg.getMapStringDoubleMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readDouble, null, "", 0.0); + }); + break; + case 6: + var value = msg.getMapStringEnumMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readEnum, null, "", 0); + }); + break; + case 7: + var value = msg.getMapStringMsgMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, MapValueMessageNoBinary.deserializeBinaryFromReader, "", new MapValueMessageNoBinary()); + }); + break; + case 8: + var value = msg.getMapInt32StringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt32, jspb.BinaryReader.prototype.readString, null, 0, ""); + }); + break; + case 9: + var value = msg.getMapInt64StringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readInt64, jspb.BinaryReader.prototype.readString, null, 0, ""); + }); + break; + case 10: + var value = msg.getMapBoolStringMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readBool, jspb.BinaryReader.prototype.readString, null, false, ""); + }); + break; + case 11: + var value = new TestMapFieldsNoBinary; + reader.readMessage(value,TestMapFieldsNoBinary.deserializeBinaryFromReader); + msg.setTestMapFields(value); + break; + case 12: + var value = msg.getMapStringTestmapfieldsMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readMessage, TestMapFieldsNoBinary.deserializeBinaryFromReader, "", new TestMapFieldsNoBinary()); + }); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; + + + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestMapFieldsNoBinary.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; + + + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestMapFieldsNoBinary} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = message.getMapStringStringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(1, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); + } + f = message.getMapStringInt32Map(true); + if (f && f.getLength() > 0) { + f.serializeBinary(2, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt32); + } + f = message.getMapStringInt64Map(true); + if (f && f.getLength() > 0) { + f.serializeBinary(3, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeInt64); + } + f = message.getMapStringBoolMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(4, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeBool); + } + f = message.getMapStringDoubleMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(5, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeDouble); + } + f = message.getMapStringEnumMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(6, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeEnum); + } + f = message.getMapStringMsgMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(7, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, MapValueMessageNoBinary.serializeBinaryToWriter); + } + f = message.getMapInt32StringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(8, writer, jspb.BinaryWriter.prototype.writeInt32, jspb.BinaryWriter.prototype.writeString); + } + f = message.getMapInt64StringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(9, writer, jspb.BinaryWriter.prototype.writeInt64, jspb.BinaryWriter.prototype.writeString); + } + f = message.getMapBoolStringMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(10, writer, jspb.BinaryWriter.prototype.writeBool, jspb.BinaryWriter.prototype.writeString); + } + f = message.getTestMapFields(); + if (f != null) { + writer.writeMessage( + 11, + f, + TestMapFieldsNoBinary.serializeBinaryToWriter + ); + } + f = message.getMapStringTestmapfieldsMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(12, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeMessage, TestMapFieldsNoBinary.serializeBinaryToWriter); + } + }; + + +} + +if (jspb.Message.GENERATE_TO_OBJECT) { /** - * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} */ -TestMapFieldsNoBinary.prototype.clearMapInt32StringMap = function() { - this.getMapInt32StringMap().clear(); - return this; +TestMapFieldsNoBinary.prototype.toObject = function(opt_includeInstance) { + return TestMapFieldsNoBinary.toObject(opt_includeInstance, this); }; /** - * map map_int64_string = 9; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.jspb.test.TestMapFieldsNoBinary} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages */ -TestMapFieldsNoBinary.prototype.getMapInt64StringMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 9, opt_noLazyCreate, - null)); -}; - +TestMapFieldsNoBinary.toObject = function(includeInstance, msg) { + var f, obj = { +mapStringStringMap: (f = msg.getMapStringStringMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringInt32Map: (f = msg.getMapStringInt32Map()) ? f.toObject(includeInstance, undefined) : [], +mapStringInt64Map: (f = msg.getMapStringInt64Map()) ? f.toObject(includeInstance, undefined) : [], +mapStringBoolMap: (f = msg.getMapStringBoolMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringDoubleMap: (f = msg.getMapStringDoubleMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringEnumMap: (f = msg.getMapStringEnumMap()) ? f.toObject(includeInstance, undefined) : [], +mapStringMsgMap: (f = msg.getMapStringMsgMap()) ? f.toObject(includeInstance, MapValueMessageNoBinary.toObject) : [], +mapInt32StringMap: (f = msg.getMapInt32StringMap()) ? f.toObject(includeInstance, undefined) : [], +mapInt64StringMap: (f = msg.getMapInt64StringMap()) ? f.toObject(includeInstance, undefined) : [], +mapBoolStringMap: (f = msg.getMapBoolStringMap()) ? f.toObject(includeInstance, undefined) : [], +testMapFields: (f = msg.getTestMapFields()) && TestMapFieldsNoBinary.toObject(includeInstance, f), +mapStringTestmapfieldsMap: (f = msg.getMapStringTestmapfieldsMap()) ? f.toObject(includeInstance, TestMapFieldsNoBinary.toObject) : [] + }; -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this - */ -TestMapFieldsNoBinary.prototype.clearMapInt64StringMap = function() { - this.getMapInt64StringMap().clear(); - return this; + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; }; +} -/** - * map map_bool_string = 10; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -TestMapFieldsNoBinary.prototype.getMapBoolStringMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 10, opt_noLazyCreate, - null)); -}; +export class MapValueMessageNoBinary extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * optional int32 foo = 1; + * @return {number} + */ + getFoo() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); + }; -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this - */ -TestMapFieldsNoBinary.prototype.clearMapBoolStringMap = function() { - this.getMapBoolStringMap().clear(); - return this; -}; + /** + * @param {number} value + * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this + */ + setFoo(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * optional TestMapFieldsNoBinary test_map_fields = 11; - * @return {?proto.jspb.test.TestMapFieldsNoBinary} - */ -TestMapFieldsNoBinary.prototype.getTestMapFields = function() { - return /** @type{?proto.jspb.test.TestMapFieldsNoBinary} */ ( - jspb.Message.getWrapperField(this, TestMapFieldsNoBinary, 11)); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this + */ + clearFoo() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * @param {?proto.jspb.test.TestMapFieldsNoBinary|undefined} value - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this -*/ -TestMapFieldsNoBinary.prototype.setTestMapFields = function(value) { - return jspb.Message.setWrapperField(this, 11, value); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasFoo() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * Clears the message field making it undefined. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this - */ -TestMapFieldsNoBinary.prototype.clearTestMapFields = function() { - return this.setTestMapFields(undefined); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.MapValueMessageNoBinary} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new MapValueMessageNoBinary; + return MapValueMessageNoBinary.deserializeBinaryFromReader(msg, reader); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestMapFieldsNoBinary.prototype.hasTestMapFields = function() { - return jspb.Message.getField(this, 11) != null; -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.MapValueMessageNoBinary} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.MapValueMessageNoBinary} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setFoo(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * map map_string_testmapfields = 12; - * @param {boolean=} opt_noLazyCreate Do not create the map if - * empty, instead returning `undefined` - * @return {!jspb.Map} - */ -TestMapFieldsNoBinary.prototype.getMapStringTestmapfieldsMap = function(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( - jspb.Message.getMapField(this, 12, opt_noLazyCreate, - TestMapFieldsNoBinary)); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + MapValueMessageNoBinary.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this - */ -TestMapFieldsNoBinary.prototype.clearMapStringTestmapfieldsMap = function() { - this.getMapStringTestmapfieldsMap().clear(); - return this; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.MapValueMessageNoBinary} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + }; +} @@ -9366,111 +8979,79 @@ foo: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.MapValueMessageNoBinary} - */ -MapValueMessageNoBinary.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new MapValueMessageNoBinary; - return MapValueMessageNoBinary.deserializeBinaryFromReader(msg, reader); -}; +export class Deeply extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Deeply} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new Deeply; + return Deeply.deserializeBinaryFromReader(msg, reader); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.MapValueMessageNoBinary} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.MapValueMessageNoBinary} - */ -MapValueMessageNoBinary.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setFoo(value); - break; - default: - reader.skipField(); - break; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Deeply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Deeply} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -MapValueMessageNoBinary.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - MapValueMessageNoBinary.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.MapValueMessageNoBinary} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -MapValueMessageNoBinary.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeInt32( - 1, - f - ); - } -}; - - -/** - * optional int32 foo = 1; - * @return {number} - */ -MapValueMessageNoBinary.prototype.getFoo = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this - */ -MapValueMessageNoBinary.prototype.setFoo = function(value) { - return jspb.Message.setField(this, 1, value); -}; + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this - */ -MapValueMessageNoBinary.prototype.clearFoo = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + Deeply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -MapValueMessageNoBinary.prototype.hasFoo = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Deeply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + }; +} @@ -9514,64 +9095,79 @@ Deeply.toObject = function(includeInstance, msg) { } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Deeply} - */ -Deeply.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new Deeply; - return Deeply.deserializeBinaryFromReader(msg, reader); -}; +Deeply.Nested = class extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Deeply.Nested} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new Deeply.Nested; + return Deeply.Nested.deserializeBinaryFromReader(msg, reader); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.Deeply} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Deeply} - */ -Deeply.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Deeply.Nested} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Deeply.Nested} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + default: + reader.skipField(); + break; + } } - } - return msg; -}; + return msg; + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -Deeply.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - Deeply.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + Deeply.Nested.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Deeply} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -Deeply.serializeBinaryToWriter = function(message, writer) { - var f = undefined; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Deeply.Nested} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + }; +} @@ -9615,64 +9211,126 @@ Deeply.Nested.toObject = function(includeInstance, msg) { } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Deeply.Nested} - */ -Deeply.Nested.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new Deeply.Nested; - return Deeply.Nested.deserializeBinaryFromReader(msg, reader); -}; +Deeply.Nested.Message = class extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * optional int32 count = 1; + * @return {number} + */ + getCount() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.Deeply.Nested} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Deeply.Nested} - */ -Deeply.Nested.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - default: - reader.skipField(); - break; + /** + * @param {number} value + * @return {!proto.jspb.test.Deeply.Nested.Message} returns this + */ + setCount(value) { + return jspb.Message.setField(this, 1, value); + }; + + + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.Deeply.Nested.Message} returns this + */ + clearCount() { + return jspb.Message.setField(this, 1, undefined); + }; + + + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasCount() { + return jspb.Message.getField(this, 1) != null; + }; + + + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.Deeply.Nested.Message} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new Deeply.Nested.Message; + return Deeply.Nested.Message.deserializeBinaryFromReader(msg, reader); + }; + + + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.Deeply.Nested.Message} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.Deeply.Nested.Message} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setCount(value); + break; + default: + reader.skipField(); + break; + } } - } - return msg; -}; + return msg; + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -Deeply.Nested.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - Deeply.Nested.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + Deeply.Nested.Message.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Deeply.Nested} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -Deeply.Nested.serializeBinaryToWriter = function(message, writer) { - var f = undefined; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.Deeply.Nested.Message} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + }; +} @@ -9716,111 +9374,6 @@ count: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Deeply.Nested.Message} - */ -Deeply.Nested.Message.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new Deeply.Nested.Message; - return Deeply.Nested.Message.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.Deeply.Nested.Message} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Deeply.Nested.Message} - */ -Deeply.Nested.Message.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setCount(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -Deeply.Nested.Message.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - Deeply.Nested.Message.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Deeply.Nested.Message} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -Deeply.Nested.Message.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeInt32( - 1, - f - ); - } -}; - - -/** - * optional int32 count = 1; - * @return {number} - */ -Deeply.Nested.Message.prototype.getCount = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; - - -/** - * @param {number} value - * @return {!proto.jspb.test.Deeply.Nested.Message} returns this - */ -Deeply.Nested.Message.prototype.setCount = function(value) { - return jspb.Message.setField(this, 1, value); -}; - - -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.Deeply.Nested.Message} returns this - */ -Deeply.Nested.Message.prototype.clearCount = function() { - return jspb.Message.setField(this, 1, undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -Deeply.Nested.Message.prototype.hasCount = function() { - return jspb.Message.getField(this, 1) != null; -}; - - /** * @enum {number} */ diff --git a/example/test2.js b/example/test2.js index d249379b..556beb31 100644 --- a/example/test2.js +++ b/example/test2.js @@ -16,98 +16,160 @@ var goog = jspb; var proto = {}; import * as protos_test_pb from '../protos/test.js'; -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function TestExtensionsMessage(opt_data) { - jspb.Message.initialize(this, opt_data, 0, 2, null, null); -}; -goog.inherits(TestExtensionsMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { +export class TestExtensionsMessage extends jspb.Message { /** - * @public - * @override + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor */ - TestExtensionsMessage.displayName = 'proto.jspb.test.TestExtensionsMessage'; -} + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, 2, null, null); + }; -/** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ -TestExtensionsMessage.extensions = {}; + /** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ + static extensions = {}; -/** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ -TestExtensionsMessage.extensionsBinary = {}; + /** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ + static extensionsBinary = {}; -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function ExtensionMessage(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(ExtensionMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { /** - * @public - * @override + * optional int32 intfield = 1; + * @return {number} */ - ExtensionMessage.displayName = 'proto.jspb.test.ExtensionMessage'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -export function ForeignNestedFieldMessage(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(ForeignNestedFieldMessage, jspb.Message); -if (goog.DEBUG && !COMPILED) { + getIntfield() { + return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); + }; + + + /** + * @param {number} value + * @return {!proto.jspb.test.TestExtensionsMessage} returns this + */ + setIntfield(value) { + return jspb.Message.setField(this, 1, value); + }; + + + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.TestExtensionsMessage} returns this + */ + clearIntfield() { + return jspb.Message.setField(this, 1, undefined); + }; + + /** - * @public - * @override + * Returns whether this field is set. + * @return {boolean} */ - ForeignNestedFieldMessage.displayName = 'proto.jspb.test.ForeignNestedFieldMessage'; + hasIntfield() { + return jspb.Message.getField(this, 1) != null; + }; + + + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.TestExtensionsMessage} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new TestExtensionsMessage; + return TestExtensionsMessage.deserializeBinaryFromReader(msg, reader); + }; + + + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.TestExtensionsMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.TestExtensionsMessage} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {number} */ (reader.readInt32()); + msg.setIntfield(value); + break; + default: + jspb.Message.readBinaryExtension(msg, reader, + TestExtensionsMessage.extensionsBinary, + TestExtensionsMessage.prototype.getExtension, + TestExtensionsMessage.prototype.setExtension); + break; + } + } + return msg; + }; + + + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + TestExtensionsMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; + + + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.TestExtensionsMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {number} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeInt32( + 1, + f + ); + } + jspb.Message.serializeBinaryExtensions(message, writer, + TestExtensionsMessage.extensionsBinary, TestExtensionsMessage.prototype.getExtension); + }; + + } @@ -155,116 +217,139 @@ intfield: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestExtensionsMessage} - */ -TestExtensionsMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new TestExtensionsMessage; - return TestExtensionsMessage.deserializeBinaryFromReader(msg, reader); -}; +export class ExtensionMessage extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ + static extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + ExtensionMessage, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + ExtensionMessage.toObject), + 0); + /** + * optional string ext1 = 1; + * @return {string} + */ + getExt1() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); + }; -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.TestExtensionsMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestExtensionsMessage} - */ -TestExtensionsMessage.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {number} */ (reader.readInt32()); - msg.setIntfield(value); - break; - default: - jspb.Message.readBinaryExtension(msg, reader, - TestExtensionsMessage.extensionsBinary, - TestExtensionsMessage.prototype.getExtension, - TestExtensionsMessage.prototype.setExtension); - break; - } - } - return msg; -}; + /** + * @param {string} value + * @return {!proto.jspb.test.ExtensionMessage} returns this + */ + setExt1(value) { + return jspb.Message.setField(this, 1, value); + }; -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -TestExtensionsMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - TestExtensionsMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; + /** + * Clears the field making it undefined. + * @return {!proto.jspb.test.ExtensionMessage} returns this + */ + clearExt1() { + return jspb.Message.setField(this, 1, undefined); + }; -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestExtensionsMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -TestExtensionsMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {number} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeInt32( - 1, - f - ); - } - jspb.Message.serializeBinaryExtensions(message, writer, - TestExtensionsMessage.extensionsBinary, TestExtensionsMessage.prototype.getExtension); -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasExt1() { + return jspb.Message.getField(this, 1) != null; + }; -/** - * optional int32 intfield = 1; - * @return {number} - */ -TestExtensionsMessage.prototype.getIntfield = function() { - return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0)); -}; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.ExtensionMessage} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new ExtensionMessage; + return ExtensionMessage.deserializeBinaryFromReader(msg, reader); + }; -/** - * @param {number} value - * @return {!proto.jspb.test.TestExtensionsMessage} returns this - */ -TestExtensionsMessage.prototype.setIntfield = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.ExtensionMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.ExtensionMessage} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setExt1(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.TestExtensionsMessage} returns this - */ -TestExtensionsMessage.prototype.clearIntfield = function() { - return jspb.Message.setField(this, 1, undefined); -}; + + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + ExtensionMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -TestExtensionsMessage.prototype.hasIntfield = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.ExtensionMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = /** @type {string} */ (jspb.Message.getField(message, 1)); + if (f != null) { + writer.writeString( + 1, + f + ); + } + }; +} @@ -308,88 +393,6 @@ ext1: (f = jspb.Message.getField(msg, 1)) == null ? undefined : f } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.ExtensionMessage} - */ -ExtensionMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new ExtensionMessage; - return ExtensionMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.ExtensionMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.ExtensionMessage} - */ -ExtensionMessage.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setExt1(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -ExtensionMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - ExtensionMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.ExtensionMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -ExtensionMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = /** @type {string} */ (jspb.Message.getField(message, 1)); - if (f != null) { - writer.writeString( - 1, - f - ); - } -}; - - - -/** - * A tuple of {field number, class constructor} for the extension - * field named `extField`. - * @type {!jspb.ExtensionFieldInfo} - */ -ExtensionMessage.extField = new jspb.ExtensionFieldInfo( - 100, - {extField: 0}, - ExtensionMessage, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - ExtensionMessage.toObject), - 0); TestExtensionsMessage.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( ExtensionMessage.extField, @@ -402,68 +405,130 @@ TestExtensionsMessage.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( // toObject() will function correctly. TestExtensionsMessage.extensions[100] = ExtensionMessage.extField; -/** - * optional string ext1 = 1; - * @return {string} - */ -ExtensionMessage.prototype.getExt1 = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); -}; +export class ForeignNestedFieldMessage extends jspb.Message { + /** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ + constructor(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); + }; + /** + * optional Deeply.Nested.Message deeply_nested_message = 1; + * @return {?proto.jspb.test.Deeply.Nested.Message} + */ + getDeeplyNestedMessage() { + return /** @type{?proto.jspb.test.Deeply.Nested.Message} */ ( + jspb.Message.getWrapperField(this, protos_test_pb.Deeply.Nested.Message, 1)); + }; -/** - * @param {string} value - * @return {!proto.jspb.test.ExtensionMessage} returns this - */ -ExtensionMessage.prototype.setExt1 = function(value) { - return jspb.Message.setField(this, 1, value); -}; + /** + * @param {?proto.jspb.test.Deeply.Nested.Message|undefined} value + * @return {!proto.jspb.test.ForeignNestedFieldMessage} returns this + */ + setDeeplyNestedMessage(value) { + return jspb.Message.setWrapperField(this, 1, value); + }; -/** - * Clears the field making it undefined. - * @return {!proto.jspb.test.ExtensionMessage} returns this - */ -ExtensionMessage.prototype.clearExt1 = function() { - return jspb.Message.setField(this, 1, undefined); -}; + /** + * Clears the message field making it undefined. + * @return {!proto.jspb.test.ForeignNestedFieldMessage} returns this + */ + clearDeeplyNestedMessage() { + return this.setDeeplyNestedMessage(undefined); + }; -/** - * Returns whether this field is set. - * @return {boolean} - */ -ExtensionMessage.prototype.hasExt1 = function() { - return jspb.Message.getField(this, 1) != null; -}; + /** + * Returns whether this field is set. + * @return {boolean} + */ + hasDeeplyNestedMessage() { + return jspb.Message.getField(this, 1) != null; + }; + /** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.jspb.test.ForeignNestedFieldMessage} + */ + static deserializeBinary(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new ForeignNestedFieldMessage; + return ForeignNestedFieldMessage.deserializeBinaryFromReader(msg, reader); + }; -/** - * A tuple of {field number, class constructor} for the extension - * field named `extField`. - * @type {!jspb.ExtensionFieldInfo} - */ -ExtensionMessage.extField = new jspb.ExtensionFieldInfo( - 100, - {extField: 0}, - ExtensionMessage, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - ExtensionMessage.toObject), - 0); -TestExtensionsMessage.extensionsBinary[100] = new jspb.ExtensionFieldBinaryInfo( - ExtensionMessage.extField, - jspb.BinaryReader.prototype.readMessage, - jspb.BinaryWriter.prototype.writeMessage, - ExtensionMessage.serializeBinaryToWriter, - ExtensionMessage.deserializeBinaryFromReader, - false); -// This registers the extension field with the extended class, so that -// toObject() will function correctly. -TestExtensionsMessage.extensions[100] = ExtensionMessage.extField; + /** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.jspb.test.ForeignNestedFieldMessage} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.jspb.test.ForeignNestedFieldMessage} + */ + static deserializeBinaryFromReader(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new protos_test_pb.Deeply.Nested.Message; + reader.readMessage(value,protos_test_pb.Deeply.Nested.Message.deserializeBinaryFromReader); + msg.setDeeplyNestedMessage(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; + }; + /** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ + serializeBinary() { + var writer = new jspb.BinaryWriter(); + ForeignNestedFieldMessage.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); + }; + + + /** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.jspb.test.ForeignNestedFieldMessage} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ + static serializeBinaryToWriter(message, writer) { + var f = undefined; + f = message.getDeeplyNestedMessage(); + if (f != null) { + writer.writeMessage( + 1, + f, + protos_test_pb.Deeply.Nested.Message.serializeBinaryToWriter + ); + } + }; + + +} + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -506,114 +571,6 @@ deeplyNestedMessage: (f = msg.getDeeplyNestedMessage()) && protos_test_pb.Deeply } -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.ForeignNestedFieldMessage} - */ -ForeignNestedFieldMessage.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new ForeignNestedFieldMessage; - return ForeignNestedFieldMessage.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.jspb.test.ForeignNestedFieldMessage} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.ForeignNestedFieldMessage} - */ -ForeignNestedFieldMessage.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new protos_test_pb.Deeply.Nested.Message; - reader.readMessage(value,protos_test_pb.Deeply.Nested.Message.deserializeBinaryFromReader); - msg.setDeeplyNestedMessage(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -ForeignNestedFieldMessage.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - ForeignNestedFieldMessage.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.ForeignNestedFieldMessage} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -ForeignNestedFieldMessage.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getDeeplyNestedMessage(); - if (f != null) { - writer.writeMessage( - 1, - f, - protos_test_pb.Deeply.Nested.Message.serializeBinaryToWriter - ); - } -}; - - -/** - * optional Deeply.Nested.Message deeply_nested_message = 1; - * @return {?proto.jspb.test.Deeply.Nested.Message} - */ -ForeignNestedFieldMessage.prototype.getDeeplyNestedMessage = function() { - return /** @type{?proto.jspb.test.Deeply.Nested.Message} */ ( - jspb.Message.getWrapperField(this, protos_test_pb.Deeply.Nested.Message, 1)); -}; - - -/** - * @param {?proto.jspb.test.Deeply.Nested.Message|undefined} value - * @return {!proto.jspb.test.ForeignNestedFieldMessage} returns this -*/ -ForeignNestedFieldMessage.prototype.setDeeplyNestedMessage = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.jspb.test.ForeignNestedFieldMessage} returns this - */ -ForeignNestedFieldMessage.prototype.clearDeeplyNestedMessage = function() { - return this.setDeeplyNestedMessage(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -ForeignNestedFieldMessage.prototype.hasDeeplyNestedMessage = function() { - return jspb.Message.getField(this, 1) != null; -}; - - /** * A tuple of {field number, class constructor} for the extension diff --git a/generator/js_generator.cc b/generator/js_generator.cc index 59e5577e..e2553b10 100644 --- a/generator/js_generator.cc +++ b/generator/js_generator.cc @@ -2068,12 +2068,18 @@ void Generator::GenerateTestOnly(const GeneratorOptions& options, void Generator::GenerateClassesAndEnums(const GeneratorOptions& options, io::Printer* printer, const FileDescriptor* file) const { - for (int i = 0; i < file->message_type_count(); i++) { - GenerateClassConstructorAndDeclareExtensionFieldInfo(options, printer, - file->message_type(i)); - } - for (int i = 0; i < file->message_type_count(); i++) { - GenerateClass(options, printer, file->message_type(i)); + if (options.import_style == GeneratorOptions::kImportEs6) { + for (int i = 0; i < file->message_type_count(); i++) { + GenerateES6Class(options, printer, file->message_type(i)); + } + } else { + for (int i = 0; i < file->message_type_count(); i++) { + GenerateClassConstructorAndDeclareExtensionFieldInfo( + options, printer, file->message_type(i)); + } + for (int i = 0; i < file->message_type_count(); i++) { + GenerateClass(options, printer, file->message_type(i)); + } } for (int i = 0; i < file->enum_type_count(); i++) { GenerateEnum(options, printer, file->enum_type(i)); @@ -2140,14 +2146,17 @@ void Generator::GenerateClassConstructor(const GeneratorOptions& options, " * @extends {jspb.Message}\n" " * @constructor\n" " */\n"); - if (IsExportedMessage(options, desc)) { + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("constructor(opt_data) {\n"); + } else if (IsExportedMessage(options, desc)) { printer->Print("export function $classname$(opt_data) {\n", "classname", LocalMessageRef(options, desc)); + printer->Annotate("classname", desc); } else { printer->Print("$classname$ = function(opt_data) {\n", "classname", LocalMessageRef(options, desc)); + printer->Annotate("classname", desc); } - printer->Annotate("classname", desc); std::string message_id = GetMessageId(desc); printer->Print( " jspb.Message.initialize(this, opt_data, $messageId$, $pivot$, " @@ -2158,20 +2167,66 @@ void Generator::GenerateClassConstructor(const GeneratorOptions& options, "pivot", GetPivot(desc), "rptfields", RepeatedFieldsArrayName(options, desc), "oneoffields", OneofFieldsArrayName(options, desc)); - printer->Print( - "};\n" - "goog.inherits($classname$, jspb.Message);\n" - "if (goog.DEBUG && !COMPILED) {\n" - // displayName overrides Function.prototype.displayName - // http://google3/javascript/externs/es3.js?l=511 - " /**\n" - " * @public\n" - " * @override\n" - " */\n" - " $classname$.displayName = '$displayname$';\n" - "}\n", - "classname", LocalMessageRef(options, desc), "displayname", - GetQualifiedMessagePath(options, desc)); + printer->Print("};\n"); + if (options.import_style != GeneratorOptions::kImportEs6) { + printer->Print( + "goog.inherits($classname$, jspb.Message);\n" + "if (goog.DEBUG && !COMPILED) {\n" + // displayName overrides Function.prototype.displayName + // http://google3/javascript/externs/es3.js?l=511 + " /**\n" + " * @public\n" + " * @override\n" + " */\n" + " $classname$.displayName = '$displayname$';\n" + "}\n", + "classname", LocalMessageRef(options, desc), "displayname", + GetQualifiedMessagePath(options, desc)); + } +} + +void Generator::GenerateES6Class(const GeneratorOptions& options, + io::Printer* printer, + const Descriptor* desc) const { + if (IgnoreMessage(desc)) { + return; + } + + if (IsExportedMessage(options, desc)) { + printer->Print("export class $classname$ extends jspb.Message {\n", + "classname", LocalMessageRef(options, desc)); + } else { + printer->Print("$classname$ = class extends jspb.Message {\n", + "classname", LocalMessageRef(options, desc)); + } + printer->Annotate("classname", desc); + printer->Indent(); + + for (int i = 0; i < desc->enum_type_count(); i++) { + GenerateEnum(options, printer, desc->enum_type(i)); + } + + GenerateClassConstructor(options, printer, desc); + + if (IsExtendable(desc) && desc->full_name() != "google.protobuf.bridge.MessageSet") { + GenerateClassExtensionFieldInfo(options, printer, desc); + } + + GenerateClassExtensionDeclarations(options, printer, desc); + GenerateClassFieldInfo(options, printer, desc); + GenerateClassFields(options, printer, desc); + GenerateClassDeserializeBinary(options, printer, desc); + GenerateClassSerializeBinary(options, printer, desc); + + printer->Outdent(); + printer->Print("}\n\n"); + + GenerateClassToObject(options, printer, desc); + GenerateClassExtensionRegistration(options, printer, desc); + + for (int i = 0; i < desc->nested_type_count(); i++) { + GenerateES6Class(options, printer, desc->nested_type(i)); + } } void Generator::GenerateClassConstructorAndDeclareExtensionFieldInfo( @@ -2201,12 +2256,18 @@ void Generator::GenerateClassFieldInfo(const GeneratorOptions& options, " * List of repeated fields within this message type.\n" " * @private {!Array}\n" " * @const\n" - " */\n" - "$classname$$rptfieldarray$ = $rptfields$;\n" - "\n", - "classname", LocalMessageRef(options, desc), "rptfieldarray", - kRepeatedFieldArrayName, "rptfields", - RepeatedFieldNumberList(options, desc)); + " */\n"); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("static repeatedFields_ = $rptfields$;\n\n", + "rptfields", RepeatedFieldNumberList(options, desc)); + } else { + printer->Print( + "$classname$$rptfieldarray$ = $rptfields$;\n" + "\n", + "classname", LocalMessageRef(options, desc), "rptfieldarray", + kRepeatedFieldArrayName, "rptfields", + RepeatedFieldNumberList(options, desc)); + } } if (HasOneofFields(desc)) { @@ -2222,11 +2283,16 @@ void Generator::GenerateClassFieldInfo(const GeneratorOptions& options, "be kept.\n" " * @private {!Array>}\n" " * @const\n" - " */\n" - "$classname$$oneofgrouparray$ = $oneofgroups$;\n" - "\n", - "classname", LocalMessageRef(options, desc), "oneofgrouparray", - kOneofGroupArrayName, "oneofgroups", OneofGroupList(desc)); + " */\n"); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("static oneofGroups_ = $oneofgroups$;\n\n", + "oneofgroups", OneofGroupList(desc)); + } else { + printer->Print("$classname$$oneofgrouparray$ = $oneofgroups$;\n" + "\n", + "classname", LocalMessageRef(options, desc), "oneofgrouparray", + kOneofGroupArrayName, "oneofgroups", OneofGroupList(desc)); + } for (int i = 0; i < desc->oneof_decl_count(); i++) { if (IgnoreOneof(desc->oneof_decl(i))) { @@ -2254,11 +2320,16 @@ void Generator::GenerateOneofCaseDefinition( printer->Print( "/**\n" " * @enum {number}\n" - " */\n" - "$classname$.$oneof$Case = {\n" - " $upcase$_NOT_SET: 0", - "classname", LocalMessageRef(options, oneof->containing_type()), "oneof", - JSOneofName(oneof), "upcase", ToEnumCase(oneof->name())); + " */\n"); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("static $oneof$Case = {\n", + "oneof", JSOneofName(oneof)); + } else { + printer->Print("$classname$.$oneof$Case = {\n", + "classname", LocalMessageRef(options, oneof->containing_type()), + "oneof", JSOneofName(oneof)); + } + printer->Print(" $upcase$_NOT_SET: 0", "upcase", ToEnumCase(oneof->name())); for (int i = 0; i < oneof->field_count(); i++) { if (IgnoreField(oneof->field(i))) { @@ -2279,8 +2350,18 @@ void Generator::GenerateOneofCaseDefinition( "\n" "/**\n" " * @return {$type$.$oneof$Case}\n" - " */\n" - "$class$.prototype.get$oneof$Case = function() {\n" + " */\n", + "type", GetQualifiedMessagePath(options, oneof->containing_type()), + "oneof", JSOneofName(oneof)); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("get$oneof$Case() {\n", + "oneof", JSOneofName(oneof)); + } else { + printer->Print("$class$.prototype.get$oneof$Case = function() {\n", + "class", LocalMessageRef(options, oneof->containing_type()), + "oneof", JSOneofName(oneof)); + } + printer->Print( " return /** @type {$type$.$oneof$Case} */(jspb.Message." "computeOneofCase(this, $class$.oneofGroups_[$oneofindex$]));\n" "};\n" @@ -2622,6 +2703,33 @@ void Generator::GenerateClassRegistration(const GeneratorOptions& options, } } +void Generator::GenerateClassExtensionDeclarations( + const GeneratorOptions& options, io::Printer* printer, + const Descriptor* desc) const { + // Just declare any extensions defined inside this message type, without + // registering. Registration happens later with a call to + // GenerateClassExtensionRegistration. + for (int i = 0; i < desc->extension_count(); i++) { + const FieldDescriptor* extension = desc->extension(i); + if (ShouldGenerateExtension(extension)) { + GenerateExtensionDeclaration(options, printer, extension); + } + } +} + +void Generator::GenerateClassExtensionRegistration( + const GeneratorOptions& options, io::Printer* printer, + const Descriptor* desc) const { + // Register the extensions defined inside this message type. Declaration + // happened earlier with a call to GenerateClassExtensionDeclarations. + for (int i = 0; i < desc->extension_count(); i++) { + const FieldDescriptor* extension = desc->extension(i); + if (ShouldGenerateExtension(extension)) { + GenerateExtensionRegistration(options, printer, extension); + } + } +} + void Generator::GenerateClassFields(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const { @@ -2639,31 +2747,48 @@ void GenerateBytesWrapper(const GeneratorOptions& options, io::Printer* printer, /* is_setter_argument = */ false, /* force_present = */ false, /* singular_if_not_packed = */ false, bytes_mode); + std::string name = JSGetterName(options, field, bytes_mode); + std::string defname = JSGetterName(options, field, BYTES_DEFAULT); printer->Print( "/**\n" " * $fielddef$\n" "$comment$" " * This is a type-conversion wrapper around `get$defname$()`\n" " * @return {$type$}\n" - " */\n" - "$class$.prototype.get$name$ = function() {\n" + " */\n", + "fielddef", FieldDefinition(options, field), + "comment", FieldComments(field, bytes_mode), + "type", type, + "defname", defname); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("get$name$() {\n", + "name", name); + } else { + printer->Print("$class$.prototype.get$name$ = function() {\n", + "class", LocalMessageRef(options, field->containing_type()), + "name", name); + } + printer->Print( " return /** @type {$type$} */ (jspb.Message.bytes$list$As$suffix$(\n" " this.get$defname$()));\n" "};\n" "\n" "\n", - "fielddef", FieldDefinition(options, field), "comment", - FieldComments(field, bytes_mode), "type", type, "class", - LocalMessageRef(options, field->containing_type()), "name", - JSGetterName(options, field, bytes_mode), "list", - field->is_repeated() ? "List" : "", "suffix", - JSByteGetterSuffix(bytes_mode), "defname", - JSGetterName(options, field, BYTES_DEFAULT)); + "type", type, + "list", field->is_repeated() ? "List" : "", + "suffix", JSByteGetterSuffix(bytes_mode), + "defname", defname); } void Generator::GenerateClassField(const GeneratorOptions& options, io::Printer* printer, const FieldDescriptor* field) const { + std::string classname = LocalMessageRef(options, field->containing_type()); + std::string gettername = "get" + JSGetterName(options, field); + std::string settername = "set" + JSGetterName(options, field); + std::string clearername = "clear" + JSGetterName(options, field); + std::string hasername = "has" + JSGetterName(options, field); + if (field->is_map()) { const FieldDescriptor* key_field = MapFieldKey(field); const FieldDescriptor* value_field = MapFieldValue(field); @@ -2688,13 +2813,21 @@ void Generator::GenerateClassField(const GeneratorOptions& options, " */\n", "fielddef", FieldDefinition(options, field), "keytype", key_type, "valuetype", value_type); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("$gettername$(opt_noLazyCreate) {\n", + "gettername", gettername); + } else { + printer->Print( + "$class$.prototype.$gettername$ = function(opt_noLazyCreate) {\n", + "class", classname, + "gettername", gettername); + } + printer->Annotate("gettername", field); printer->Print( - "$class$.prototype.$gettername$ = function(opt_noLazyCreate) {\n" " return /** @type {!jspb.Map<$keytype$,$valuetype$>} */ (\n", - "class", LocalMessageRef(options, field->containing_type()), - "gettername", "get" + JSGetterName(options, field), "keytype", key_type, + "class", classname, + "keytype", key_type, "valuetype", value_type); - printer->Annotate("gettername", field); printer->Print( " jspb.Message.getMapField(this, $index$, opt_noLazyCreate", "index", JSFieldIndex(field)); @@ -2732,16 +2865,23 @@ void Generator::GenerateClassField(const GeneratorOptions& options, /* is_setter_argument = */ false, /* force_present = */ false, /* singular_if_not_packed = */ false)); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("$gettername$() {\n", + "gettername", gettername); + } else { + printer->Print("$class$.prototype.$gettername$ = function() {\n", + "class", classname, + "gettername", gettername); + } + printer->Annotate("gettername", field); printer->Print( - "$class$.prototype.$gettername$ = function() {\n" " return /** @type{$type$} */ (\n" " jspb.Message.get$rpt$WrapperField(this, $wrapperclass$, " "$index$$required$));\n" "};\n" "\n" "\n", - "class", LocalMessageRef(options, field->containing_type()), - "gettername", "get" + JSGetterName(options, field), "type", + "type", JSFieldTypeAnnotation(options, field, /* is_setter_argument = */ false, /* force_present = */ false, @@ -2750,26 +2890,31 @@ void Generator::GenerateClassField(const GeneratorOptions& options, JSFieldIndex(field), "wrapperclass", SubmessageTypeRef(options, field), "required", (field->label() == FieldDescriptor::LABEL_REQUIRED ? ", 1" : "")); - printer->Annotate("gettername", field); printer->Print( "/**\n" " * @param {$optionaltype$} value\n" " * @return {!$returntype$} returns this\n" - "*/\n" - "$class$.prototype.$settername$ = function(value) {\n" - " return jspb.Message.set$oneoftag$$repeatedtag$WrapperField(", + "*/\n", "optionaltype", JSFieldTypeAnnotation(options, field, /* is_setter_argument = */ true, /* force_present = */ false, /* singular_if_not_packed = */ false), - "class", LocalMessageRef(options, field->containing_type()), "returntype", - GetQualifiedMessagePath(options, field->containing_type()), - "settername", "set" + JSGetterName(options, field), "oneoftag", - (InRealOneof(field) ? "Oneof" : ""), "repeatedtag", - (field->is_repeated() ? "Repeated" : "")); + GetQualifiedMessagePath(options, field->containing_type())); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("$settername$(value) {\n", + "settername", settername); + } else { + printer->Print("$class$.prototype.$settername$ = function(value) {\n", + "class", classname, + "settername", settername); + } printer->Annotate("settername", field); + printer->Print( + " return jspb.Message.set$oneoftag$$repeatedtag$WrapperField(", + "oneoftag", (InRealOneof(field) ? "Oneof" : ""), + "repeatedtag", (field->is_repeated() ? "Repeated" : "")); printer->Print( "this, $index$$oneofgroup$, value);\n" @@ -2817,9 +2962,14 @@ void Generator::GenerateClassField(const GeneratorOptions& options, FieldComments(field, bytes_mode), "type", typed_annotation); } - printer->Print("$class$.prototype.$gettername$ = function() {\n", "class", - LocalMessageRef(options, field->containing_type()), - "gettername", "get" + JSGetterName(options, field)); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("$gettername$() {\n", + "gettername", gettername); + } else { + printer->Print("$class$.prototype.$gettername$ = function() {\n", + "class", classname, + "gettername", gettername); + } printer->Annotate("gettername", field); if (untyped) { @@ -2876,30 +3026,32 @@ void Generator::GenerateClassField(const GeneratorOptions& options, /* force_present = */ false, /* singular_if_not_packed = */ false)); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("$settername$(value) {\n", + "settername", settername); + } else { + printer->Print("$class$.prototype.$settername$ = function(value) {\n", + "class", classname, + "settername", settername); + } + printer->Annotate("settername", field); if (!field->is_repeated() && !field->is_map() && !field->has_presence()) { // Proto3 non-repeated and non-map fields without presence use the // setProto3*Field function. printer->Print( - "$class$.prototype.$settername$ = function(value) {\n" " return jspb.Message.setProto3$typetag$Field(this, $index$, " "value);" "\n" "};\n" "\n" "\n", - "class", LocalMessageRef(options, field->containing_type()), - "settername", "set" + JSGetterName(options, field), "typetag", - JSTypeTag(field), "index", JSFieldIndex(field)); - printer->Annotate("settername", field); + "typetag", JSTypeTag(field), + "index", JSFieldIndex(field)); } else { // Otherwise, use the regular setField function. - printer->Print( - "$class$.prototype.$settername$ = function(value) {\n" - " return jspb.Message.set$oneoftag$Field(this, $index$", - "class", LocalMessageRef(options, field->containing_type()), - "settername", "set" + JSGetterName(options, field), "oneoftag", - (InRealOneof(field) ? "Oneof" : ""), "index", JSFieldIndex(field)); - printer->Annotate("settername", field); + printer->Print(" return jspb.Message.set$oneoftag$Field(this, $index$", + "oneoftag", (InRealOneof(field) ? "Oneof" : ""), + "index", JSFieldIndex(field)); printer->Print( "$oneofgroup$, $type$value$rptvalueinit$$typeclose$);\n" "};\n" @@ -2934,19 +3086,25 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "/**\n" " * Clears values from the map. The map will be non-null.\n" " * @return {!$returntype$} returns this\n" - " */\n" - "$class$.prototype.$clearername$ = function() {\n" + " */\n", + "returntype", GetQualifiedMessagePath(options, field->containing_type())); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("$clearername$function() {\n", + "clearername", clearername); + } else { + printer->Print("$class$.prototype.$clearername$ = function() {\n", + "class", classname, + "clearername", clearername); + } + printer->Annotate("clearername", field); + printer->Print( " this.$gettername$().clear();\n" " return this;\n" "};\n" "\n" "\n", - "class", LocalMessageRef(options, field->containing_type()), - "returntype", GetQualifiedMessagePath(options, field->containing_type()), - "clearername", "clear" + JSGetterName(options, field), - "gettername", "get" + JSGetterName(options, field)); + "gettername", gettername); // clang-format on - printer->Annotate("clearername", field); } else if (field->is_repeated() || (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && !field->is_required())) { @@ -2956,22 +3114,28 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "/**\n" " * $jsdoc$\n" " * @return {!$returntype$} returns this\n" - " */\n" - "$class$.prototype.$clearername$ = function() {\n" + " */\n", + "jsdoc", field->is_repeated() + ? "Clears the list making it empty but non-null." + : "Clears the message field making it undefined.", + "returntype", GetQualifiedMessagePath(options, field->containing_type())); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("$clearername$() {\n", + "clearername", clearername); + } else { + printer->Print("$class$.prototype.$clearername$ = function() {\n", + "class", classname, + "clearername", clearername); + } + printer->Annotate("clearername", field); + printer->Print( " return this.$settername$($clearedvalue$);\n" "};\n" "\n" "\n", - "jsdoc", field->is_repeated() - ? "Clears the list making it empty but non-null." - : "Clears the message field making it undefined.", - "class", LocalMessageRef(options, field->containing_type()), - "returntype", GetQualifiedMessagePath(options, field->containing_type()), - "clearername", "clear" + JSGetterName(options, field), - "settername", "set" + JSGetterName(options, field), + "settername", settername, "clearedvalue", (field->is_repeated() ? "[]" : "undefined")); // clang-format on - printer->Annotate("clearername", field); } else if (HasFieldPresence(options, field)) { // Fields where we can't delegate to the regular setter because it doesn't // accept "undefined" as an argument. @@ -2980,20 +3144,26 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "/**\n" " * Clears the field making it undefined.\n" " * @return {!$returntype$} returns this\n" - " */\n" - "$class$.prototype.$clearername$ = function() {\n" + " */\n", + "returntype", GetQualifiedMessagePath(options, field->containing_type())); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("$clearername$() {\n", + "clearername", clearername); + } else { + printer->Print("$class$.prototype.$clearername$ = function() {\n", + "class", classname, + "clearername", clearername); + } + printer->Annotate("clearername", field); + printer->Print( " return jspb.Message.set$maybeoneof$Field(this, " "$index$$maybeoneofgroup$, ", - "class", LocalMessageRef(options, field->containing_type()), - "returntype", GetQualifiedMessagePath(options, field->containing_type()), - "clearername", "clear" + JSGetterName(options, field), "maybeoneof", (InRealOneof(field) ? "Oneof" : ""), "maybeoneofgroup", (InRealOneof(field) ? (", " + JSOneofArray(options, field)) : ""), "index", JSFieldIndex(field)); // clang-format on - printer->Annotate("clearername", field); printer->Print( "$clearedvalue$);\n" "};\n" @@ -3007,36 +3177,37 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "/**\n" " * Returns whether this field is set.\n" " * @return {boolean}\n" - " */\n" - "$class$.prototype.$hasername$ = function() {\n" + " */\n"); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("$hasername$() {\n", + "hasername", hasername); + } else { + printer->Print("$class$.prototype.$hasername$ = function() {\n", + "class", classname, + "hasername", hasername); + } + printer->Annotate("hasername", field); + printer->Print( " return jspb.Message.getField(this, $index$) != null;\n" "};\n" "\n" "\n", - "class", LocalMessageRef(options, field->containing_type()), - "hasername", "has" + JSGetterName(options, field), "index", - JSFieldIndex(field)); - printer->Annotate("hasername", field); + "index", JSFieldIndex(field)); } } void Generator::GenerateRepeatedPrimitiveHelperMethods( const GeneratorOptions& options, io::Printer* printer, const FieldDescriptor* field, bool untyped) const { + std::string addername = "add" + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list = */ true); // clang-format off printer->Print( "/**\n" " * @param {$optionaltype$} value\n" " * @param {number=} opt_index\n" " * @return {!$returntype$} returns this\n" - " */\n" - "$class$.prototype.$addername$ = function(value, opt_index) {\n" - " return jspb.Message.addToRepeatedField(this, " - "$index$", - "class", LocalMessageRef(options, field->containing_type()), - "returntype", GetQualifiedMessagePath(options, field->containing_type()), "addername", - "add" + JSGetterName(options, field, BYTES_DEFAULT, - /* drop_list = */ true), + " */\n", + "returntype", GetQualifiedMessagePath(options, field->containing_type()), "optionaltype", JSFieldTypeAnnotation( options, field, @@ -3044,9 +3215,19 @@ void Generator::GenerateRepeatedPrimitiveHelperMethods( /* force_present = */ true, /* singular_if_not_packed = */ false, BYTES_DEFAULT, - /* force_singular = */ true), - "index", JSFieldIndex(field)); + /* force_singular = */ true)); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("$addername$(value, opt_index) {\n", + "addername", addername); + } else { + printer->Print("$class$.prototype.$addername$ = function(value, opt_index) {\n", + "class", LocalMessageRef(options, field->containing_type()), + "addername", addername); + } printer->Annotate("addername", field); + printer->Print( + " return jspb.Message.addToRepeatedField(this, $index$", + "index", JSFieldIndex(field)); printer->Print( "$oneofgroup$, $type$value$rptvalueinit$$typeclose$, " "opt_index);\n" @@ -3063,20 +3244,25 @@ void Generator::GenerateRepeatedPrimitiveHelperMethods( void Generator::GenerateRepeatedMessageHelperMethods( const GeneratorOptions& options, io::Printer* printer, const FieldDescriptor* field) const { + std::string addername = "add" + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list = */ true); printer->Print( "/**\n" " * @param {$optionaltype$=} opt_value\n" " * @param {number=} opt_index\n" " * @return {$optionaltype$}\n" - " */\n" - "$class$.prototype.$addername$ = function(opt_value, opt_index) {\n" - " return jspb.Message.addTo$repeatedtag$WrapperField(", + " */\n", "optionaltype", JSFieldTypeAnnotation(options, field, false, true, false, BYTES_DEFAULT, - true), - "class", LocalMessageRef(options, field->containing_type()), "addername", - "add" + JSGetterName(options, field, BYTES_DEFAULT, - /* drop_list = */ true), + true)); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("$addername$(opt_value, opt_index) {\n", + "addername", addername); + } else { + printer->Print("$class$.prototype.$addername$ = function(opt_value, opt_index) {\n", + "class", LocalMessageRef(options, field->containing_type()), + "addername", addername); + } + printer->Print(" return jspb.Message.addTo$repeatedtag$WrapperField(", "repeatedtag", (field->is_repeated() ? "Repeated" : "")); printer->Annotate("addername", field); @@ -3110,10 +3296,14 @@ void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options, " * works in OPTIMIZED mode.\n" " *\n" " * @type {!Object}\n" - " */\n" - "$class$.extensions = {};\n" - "\n", - "class", LocalMessageRef(options, desc)); + " */\n"); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("static extensions = {};\n\n"); + } else { + printer->Print("$class$.extensions = {};\n" + "\n", + "class", LocalMessageRef(options, desc)); + } printer->Print( "\n" @@ -3131,10 +3321,14 @@ void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options, " * works in OPTIMIZED mode.\n" " *\n" " * @type {!Object}\n" - " */\n" - "$class$.extensionsBinary = {};\n" - "\n", - "class", LocalMessageRef(options, desc)); + " */\n"); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("static extensionsBinary = {};\n\n"); + } else { + printer->Print("$class$.extensionsBinary = {};\n" + "\n", + "class", LocalMessageRef(options, desc)); + } } } @@ -3144,13 +3338,22 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options, // TODO(cfallin): Handle lazy decoding when requested by field option and/or // by default for 'bytes' fields and packed repeated fields. + std::string classname = LocalMessageRef(options, desc); + std::string classtype = GetQualifiedMessagePath(options, desc); printer->Print( "/**\n" " * Deserializes binary data (in protobuf wire format).\n" " * @param {jspb.ByteSource} bytes The bytes to deserialize.\n" " * @return {!$classtype$}\n" - " */\n" - "$classname$.deserializeBinary = function(bytes) {\n" + " */\n", + "classtype", classtype); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("static deserializeBinary(bytes) {\n"); + } else { + printer->Print("$classname$.deserializeBinary = function(bytes) {\n", + "classname", classname); + } + printer->Print( " var reader = new jspb.BinaryReader(bytes);\n" " var msg = new $classname$;\n" " return $classname$.deserializeBinaryFromReader(msg, reader);\n" @@ -3163,12 +3366,17 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options, " * @param {!$classtype$} msg The message object to deserialize into.\n" " * @param {!jspb.BinaryReader} reader The BinaryReader to use.\n" " * @return {!$classtype$}\n" - " */\n" - "$classname$.deserializeBinaryFromReader = function(msg, reader) {\n" - " while (reader.nextField()) {\n", - "classname", LocalMessageRef(options, desc), "classtype", - GetQualifiedMessagePath(options, desc)); + " */\n", + "classname", classname, + "classtype", classtype); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("static deserializeBinaryFromReader(msg, reader) {\n"); + } else { + printer->Print("$classname$.deserializeBinaryFromReader = function(msg, reader) {\n", + "classname", classname); + } printer->Print( + " while (reader.nextField()) {\n" " if (reader.isEndGroup()) {\n" " break;\n" " }\n" @@ -3190,8 +3398,8 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options, " $class$.prototype.setExtension);\n" " break;\n" " }\n", - "extobj", JSExtensionsObjectName(options, desc->file(), desc), "class", - LocalMessageRef(options, desc)); + "extobj", JSExtensionsObjectName(options, desc->file(), desc), + "class", classname); } else { printer->Print( " reader.skipField();\n" @@ -3301,12 +3509,20 @@ void Generator::GenerateClassDeserializeBinaryField( void Generator::GenerateClassSerializeBinary(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const { + std::string classname = LocalMessageRef(options, desc); + std::string classtype = GetQualifiedMessagePath(options, desc); printer->Print( "/**\n" " * Serializes the message to binary data (in protobuf wire format).\n" " * @return {!Uint8Array}\n" - " */\n" - "$classname$.prototype.serializeBinary = function() {\n" + " */\n"); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("serializeBinary() {\n"); + } else { + printer->Print("$classname$.prototype.serializeBinary = function() {\n", + "classname", classname); + } + printer->Print( " var writer = new jspb.BinaryWriter();\n" " $classname$.serializeBinaryToWriter(this, writer);\n" " return writer.getResultBuffer();\n" @@ -3319,12 +3535,16 @@ void Generator::GenerateClassSerializeBinary(const GeneratorOptions& options, " * @param {!$classtype$} message\n" " * @param {!jspb.BinaryWriter} writer\n" " * @suppress {unusedLocalVariables} f is only used for nested messages\n" - " */\n" - "$classname$.serializeBinaryToWriter = function(message, " - "writer) {\n" - " var f = undefined;\n", - "classname", LocalMessageRef(options, desc), "classtype", - GetQualifiedMessagePath(options, desc)); + " */\n", + "classname", classname, + "classtype", classtype); + if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("static serializeBinaryToWriter(message, writer) {\n"); + } else { + printer->Print("$classname$.serializeBinaryToWriter = function(message, writer) {\n", + "classname", classname); + } + printer->Print(" var f = undefined;\n"); for (int i = 0; i < desc->field_count(); i++) { if (!IgnoreField(desc->field(i))) { @@ -3469,6 +3689,9 @@ void Generator::GenerateEnum(const GeneratorOptions& options, if (IsExportedEnum(options, enumdesc)) { printer->Print("export const $enumname$ = {\n", "enumname", LocalEnumRef(options, enumdesc)); + } else if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("static $enumname$ = {\n", + "enumname", enumdesc->name()); } else { printer->Print("$enumname$ = {\n", "enumname", LocalEnumRef(options, enumdesc)); @@ -3500,6 +3723,13 @@ void Generator::GenerateEnum(const GeneratorOptions& options, void Generator::GenerateExtension(const GeneratorOptions& options, io::Printer* printer, const FieldDescriptor* field) const { + GenerateExtensionDeclaration(options, printer, field); + GenerateExtensionRegistration(options, printer, field); +} + +void Generator::GenerateExtensionDeclaration( + const GeneratorOptions& options, io::Printer* printer, + const FieldDescriptor* field) const { const std::string extension_object_name = JSObjectFieldName(options, field); printer->Print( "\n" @@ -3521,7 +3751,10 @@ void Generator::GenerateExtension(const GeneratorOptions& options, if (!scope_desc && options.import_style == GeneratorOptions::kImportEs6) { extension_scope = ""; printer->Print("export const $name$ = new jspb.ExtensionFieldInfo(\n", - "name", extension_object_name); + "name", extension_object_name); + } else if (options.import_style == GeneratorOptions::kImportEs6) { + printer->Print("static $name$ = new jspb.ExtensionFieldInfo(\n", + "name", extension_object_name); } else { extension_scope += "."; printer->Print("$class$$name$ = new jspb.ExtensionFieldInfo(\n", "class", @@ -3546,6 +3779,23 @@ void Generator::GenerateExtension(const GeneratorOptions& options, ? (SubmessageTypeRef(options, field) + ".toObject") : std::string("null")), "repeated", (field->is_repeated() ? "1" : "0")); +} + +void Generator::GenerateExtensionRegistration( + const GeneratorOptions& options, io::Printer* printer, + const FieldDescriptor* field) const { + + const std::string extension_object_name = JSObjectFieldName(options, field); + const Descriptor* scope_desc = field->extension_scope(); + std::string extension_scope = + (scope_desc ? MaybeCrossFileMessageRef(options, field->file(), scope_desc) + : GetNamespace(options, field->file())); + + if (!scope_desc && options.import_style == GeneratorOptions::kImportEs6) { + extension_scope = ""; + } else { + extension_scope += "."; + } printer->Print( "\n" @@ -3941,12 +4191,12 @@ void Generator::GenerateDTS(const GeneratorOptions& options, for (int i = 0; i < file->message_type_count(); i++) { auto desc = file->message_type(i); - GenerateMessageDTS(options, printer, desc, ""); + GenerateMessageDTS(options, printer, desc); } for (int i = 0; i < file->enum_type_count(); i++) { auto enumdesc = file->enum_type(i); - GenerateEnumDTS(options, printer, enumdesc, ""); + GenerateEnumDTS(options, printer, enumdesc); } // Emit well-known type methods. @@ -3959,51 +4209,47 @@ void Generator::GenerateDTS(const GeneratorOptions& options, } void Generator::GenerateMessageDTS(const GeneratorOptions& options, - io::Printer* printer, const Descriptor* desc, - const std::string& indent) const { + io::Printer* printer, + const Descriptor* desc) const { if (IgnoreMessage(desc)) { return; } - std::string prefix = indent; - if (indent == "") { - prefix = "export "; - } - + const std::string prefix = + IsExportedMessage(options, desc) ? "export " : ""; printer->Print("$prefix$class $classname$ extends jspb.Message {\n", "classname", desc->name(), "prefix", prefix); - const std::string nested_indent = indent + DTS_INDENT; - printer->Print("$indent$constructor(data?: any[] | null);\n", "indent", - nested_indent); + printer->Indent(); + printer->Print("constructor(data?: any[] | null);\n"); if (HasOneofFields(desc)) { for (int i = 0; i < desc->oneof_decl_count(); i++) { - GenerateOneofMethodDTS(options, printer, desc->oneof_decl(i), - nested_indent); + GenerateOneofMethodDTS(options, printer, desc->oneof_decl(i)); } } printer->Print( - "$indent$toObject(includeInstance?: boolean): { [key: string]: unknown " + "toObject(includeInstance?: boolean): { [key: string]: unknown " "};\n" - "$indent$static toObject(includeInstance: boolean | undefined, msg: " + "static toObject(includeInstance: boolean | undefined, msg: " "$class$): { [key: string]: unknown };\n" - "$indent$static deserializeBinary(bytes: jspb.ByteSource): $class$;\n" - "$indent$static deserializeBinaryFromReader(msg: $class$, reader: " + "static deserializeBinary(bytes: jspb.ByteSource): $class$;\n" + "static deserializeBinaryFromReader(msg: $class$, reader: " "jspb.BinaryReader): $class$;\n" - "$indent$serializeBinary(): Uint8Array;\n" - "$indent$static serializeBinaryToWriter(message: $class$, writer: " + "serializeBinary(): Uint8Array;\n" + "static serializeBinaryToWriter(message: $class$, writer: " "jspb.BinaryWriter): void;\n", - "class", LocalMessageRef(options, desc), "indent", nested_indent); + "class", LocalMessageRef(options, desc)); for (int i = 0; i < desc->field_count(); i++) { if (!IgnoreField(desc->field(i))) { - GenerateFieldDTS(options, printer, desc->field(i), nested_indent); + GenerateFieldDTS(options, printer, desc->field(i)); } } - printer->Print("$indent$}\n\n", "indent", indent); + printer->Outdent(); + printer->Print("}\n\n"); bool has_subtypes = false; if (HasOneofFields(desc)) { @@ -4021,62 +4267,62 @@ void Generator::GenerateMessageDTS(const GeneratorOptions& options, if (has_subtypes) { printer->Print("$prefix$namespace $classname$ {\n", "prefix", prefix, "classname", desc->name()); + printer->Indent(); + if (HasOneofFields(desc)) { for (int i = 0; i < desc->oneof_decl_count(); i++) { - GenerateOneofEnumDTS(options, printer, desc->oneof_decl(i), - nested_indent); + GenerateOneofEnumDTS(options, printer, desc->oneof_decl(i)); } } for (int i = 0; i < desc->nested_type_count(); i++) { - GenerateMessageDTS(options, printer, desc->nested_type(i), nested_indent); + GenerateMessageDTS(options, printer, desc->nested_type(i)); } for (int i = 0; i < desc->enum_type_count(); i++) { - GenerateEnumDTS(options, printer, desc->enum_type(i), nested_indent); + GenerateEnumDTS(options, printer, desc->enum_type(i)); } - printer->Print("$indent$}\n\n", "indent", indent); + + printer->Outdent(); + printer->Print("}\n\n"); } } void Generator::GenerateOneofEnumDTS(const GeneratorOptions& options, io::Printer* printer, - const OneofDescriptor* oneof, - const std::string& indent) const { + const OneofDescriptor* oneof) const { if (IgnoreOneof(oneof)) { return; } - printer->Print("$indent$enum $oneof$Case {\n", "oneof", JSOneofName(oneof), - "indent", indent); + printer->Print("enum $oneof$Case {\n", "oneof", JSOneofName(oneof)); + printer->Indent(); - const std::string nested_indent = indent + DTS_INDENT; - printer->Print("$indent$$upcase$_NOT_SET = 0,\n", "upcase", - ToEnumCase(oneof->name()), "indent", nested_indent); + printer->Print("$upcase$_NOT_SET = 0,\n", "upcase", + ToEnumCase(oneof->name())); for (int i = 0; i < oneof->field_count(); i++) { auto field = oneof->field(i); if (IgnoreField(field)) { continue; } - printer->Print("$indent$$upcase$ = $number$,\n", "upcase", - ToEnumCase(field->name()), "number", JSFieldIndex(field), - "indent", nested_indent); + printer->Print("$upcase$ = $number$,\n", "upcase", + ToEnumCase(field->name()), "number", JSFieldIndex(field)); } - printer->Print("$indent$}\n", "indent", indent); + printer->Outdent(); + printer->Print("}\n"); } void Generator::GenerateOneofMethodDTS(const GeneratorOptions& options, io::Printer* printer, - const OneofDescriptor* oneof, - const std::string& indent) const { + const OneofDescriptor* oneof) const { if (IgnoreOneof(oneof)) { return; } - printer->Print("$indent$get$oneof$Case(): $class$.$oneof$Case;\n", "class", + printer->Print("get$oneof$Case(): $class$.$oneof$Case;\n", "class", LocalMessageRef(options, oneof->containing_type()), "oneof", - JSOneofName(oneof), "indent", indent); + JSOneofName(oneof)); } std::string DTSTypeName(const GeneratorOptions& options, @@ -4144,72 +4390,66 @@ std::string DTSFieldSetterType(const GeneratorOptions& options, void Generator::GenerateFieldDTS(const GeneratorOptions& options, io::Printer* printer, - const FieldDescriptor* field, - const std::string& indent) const { + const FieldDescriptor* field) const { if (field->is_map()) { printer->Print( - "$indent$$gettername$(noLazyCreate?: boolean): " + "$gettername$(noLazyCreate?: boolean): " "jspb.Map<$keytype$,$valuetype$> " "| undefined;\n", "gettername", "get" + JSGetterName(options, field), "keytype", DTSFieldType(options, MapFieldKey(field)), "valuetype", - DTSFieldType(options, MapFieldValue(field)), "indent", indent); + DTSFieldType(options, MapFieldValue(field))); } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { - printer->Print("$indent$$gettername$(): $type$;\n", "gettername", + printer->Print("$gettername$(): $type$;\n", "gettername", "get" + JSGetterName(options, field), "type", - DTSFieldReturnType(options, field), "indent", indent); - printer->Print("$indent$$settername$(value: $optionaltype$): $class$;\n", + DTSFieldReturnType(options, field)); + printer->Print("$settername$(value: $optionaltype$): $class$;\n", "settername", "set" + JSGetterName(options, field), "optionaltype", DTSFieldSetterType(options, field), "class", - LocalMessageRef(options, field->containing_type()), "indent", - indent); + LocalMessageRef(options, field->containing_type())); if (field->is_repeated()) { printer->Print( - "$indent$$addername$(value?: $optionaltype$, index?: number): " + "$addername$(value?: $optionaltype$, index?: number): " "$optionaltype$;\n", "addername", "add" + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list */ true), "optionaltype", DTSFieldType(options, field, BYTES_DEFAULT, - /* force_singular */ true), - "indent", indent); + /* force_singular */ true)); } } else { BytesMode bytes_mode = field->type() == FieldDescriptor::TYPE_BYTES && !options.binary ? BYTES_B64 : BYTES_DEFAULT; - printer->Print("$indent$$gettername$(): $type$;\n", "gettername", + printer->Print("$gettername$(): $type$;\n", "gettername", "get" + JSGetterName(options, field), "type", - DTSFieldReturnType(options, field, bytes_mode), "indent", - indent); + DTSFieldReturnType(options, field, bytes_mode)); if (field->type() == FieldDescriptor::TYPE_BYTES) { - printer->Print("$indent$get$name$(): $type$;\n", "type", + printer->Print("get$name$(): $type$;\n", "type", DTSFieldReturnType(options, field, BYTES_B64), "name", - JSGetterName(options, field, BYTES_B64), "indent", indent); - printer->Print("$indent$get$name$(): $type$;\n", "type", + JSGetterName(options, field, BYTES_B64)); + printer->Print("get$name$(): $type$;\n", "type", DTSFieldReturnType(options, field, BYTES_U8), "name", - JSGetterName(options, field, BYTES_U8), "indent", indent); + JSGetterName(options, field, BYTES_U8)); } - printer->Print("$indent$$settername$(value: $optionaltype$): $class$;\n", + printer->Print("$settername$(value: $optionaltype$): $class$;\n", "settername", "set" + JSGetterName(options, field), "optionaltype", DTSFieldSetterType(options, field), "class", - LocalMessageRef(options, field->containing_type()), "indent", - indent); + LocalMessageRef(options, field->containing_type())); if (field->is_repeated()) { printer->Print( - "$indent$$addername$(value: $optionaltype$, index?: number): " + "$addername$(value: $optionaltype$, index?: number): " "$class$;\n", "addername", "add" + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list = */ true), "optionaltype", DTSFieldType(options, field, BYTES_DEFAULT, true), - "class", LocalMessageRef(options, field->containing_type()), "indent", - indent); + "class", LocalMessageRef(options, field->containing_type())); } } @@ -4217,29 +4457,25 @@ void Generator::GenerateFieldDTS(const GeneratorOptions& options, (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE && !field->is_required()) || HasFieldPresence(options, field)) { - printer->Print("$indent$$clearername$(): $class$;\n", "clearername", + printer->Print("$clearername$(): $class$;\n", "clearername", "clear" + JSGetterName(options, field), "class", - LocalMessageRef(options, field->containing_type()), "indent", - indent); + LocalMessageRef(options, field->containing_type())); } if (HasFieldPresence(options, field)) { - printer->Print("$indent$$hasername$(): boolean;\n", "hasername", - "has" + JSGetterName(options, field), "indent", indent); + printer->Print("$hasername$(): boolean;\n", "hasername", + "has" + JSGetterName(options, field)); } } void Generator::GenerateEnumDTS(const GeneratorOptions& options, io::Printer* printer, - const EnumDescriptor* enumdesc, - const std::string& indent) const { - std::string prefix = indent; - if (indent == "") { - prefix = "export "; - } - + const EnumDescriptor* enumdesc) const { + const std::string prefix = + IsExportedEnum(options, enumdesc) ? "export " : ""; printer->Print("$prefix$enum $name$ {\n", "prefix", prefix, "name", enumdesc->name()); + printer->Indent(); std::set used_name; std::vector valid_values; @@ -4252,14 +4488,14 @@ void Generator::GenerateEnumDTS(const GeneratorOptions& options, valid_values.push_back(value); } - const std::string nested_indent = indent + DTS_INDENT; for (auto value : valid_values) { - printer->Print("$indent$$name$ = $value$,\n", "indent", nested_indent, + printer->Print("$name$ = $value$,\n", "name", ToEnumCase(value->name()), "value", absl::StrCat(value->number())); } - printer->Print("$indent$}\n\n", "indent", indent); + printer->Outdent(); + printer->Print("}\n\n"); } bool Generator::GenerateAll(const std::vector& files, diff --git a/generator/js_generator.h b/generator/js_generator.h index 49231b46..1b297fbd 100644 --- a/generator/js_generator.h +++ b/generator/js_generator.h @@ -241,21 +241,17 @@ class Generator : public CodeGenerator { void GenerateDTS(const GeneratorOptions& options, io::Printer* printer, const FileDescriptor* file) const; void GenerateMessageDTS(const GeneratorOptions& options, io::Printer* printer, - const Descriptor* desc, - const std::string& indent) const; + const Descriptor* desc) const; void GenerateOneofMethodDTS(const GeneratorOptions& options, io::Printer* printer, - const OneofDescriptor* oneof, - const std::string& indent) const; + const OneofDescriptor* oneof) const; void GenerateOneofEnumDTS(const GeneratorOptions& options, - io::Printer* printer, const OneofDescriptor* oneof, - const std::string& indent) const; + io::Printer* printer, + const OneofDescriptor* oneof) const; void GenerateFieldDTS(const GeneratorOptions& options, io::Printer* printer, - const FieldDescriptor* field, - const std::string& indent) const; + const FieldDescriptor* field) const; void GenerateEnumDTS(const GeneratorOptions& options, io::Printer* printer, - const EnumDescriptor* enumdesc, - const std::string& indent) const; + const EnumDescriptor* enumdesc) const; // Generate definitions for all message classes and enums in all files, // processing the files in dependence order. @@ -281,6 +277,8 @@ class Generator : public CodeGenerator { // Generate definition for one class. void GenerateClass(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const; + void GenerateES6Class(const GeneratorOptions& options, io::Printer* printer, + const Descriptor* desc) const; void GenerateClassConstructor(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const; @@ -313,6 +311,13 @@ class Generator : public CodeGenerator { void GenerateClassRegistration(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const; + void GenerateClassExtensionDeclarations(const GeneratorOptions& options, + io::Printer* printer, + const Descriptor* desc) const; + void GenerateClassExtensionRegistration(const GeneratorOptions& options, + io::Printer* printer, + const Descriptor* desc) const; + void GenerateClassFields(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const; void GenerateClassField(const GeneratorOptions& options, io::Printer* printer, @@ -343,6 +348,12 @@ class Generator : public CodeGenerator { // Generate an extension definition. void GenerateExtension(const GeneratorOptions& options, io::Printer* printer, const FieldDescriptor* field) const; + void GenerateExtensionDeclaration(const GeneratorOptions& options, + io::Printer* printer, + const FieldDescriptor* field) const; + void GenerateExtensionRegistration(const GeneratorOptions& options, + io::Printer* printer, + const FieldDescriptor* field) const; // Generate addFoo() method for repeated primitive fields. void GenerateRepeatedPrimitiveHelperMethods(const GeneratorOptions& options, From d29b77fef35c655b58f1a4b7b805acce2481b271 Mon Sep 17 00:00:00 2001 From: Ryan Brown Date: Mon, 28 Jul 2025 19:21:17 -0600 Subject: [PATCH 09/12] Don't use class (static) properties. --- generator/js_generator.cc | 89 ++++++++++++++------------------------- 1 file changed, 32 insertions(+), 57 deletions(-) diff --git a/generator/js_generator.cc b/generator/js_generator.cc index e2553b10..11ac4e11 100644 --- a/generator/js_generator.cc +++ b/generator/js_generator.cc @@ -2202,18 +2202,10 @@ void Generator::GenerateES6Class(const GeneratorOptions& options, printer->Annotate("classname", desc); printer->Indent(); - for (int i = 0; i < desc->enum_type_count(); i++) { - GenerateEnum(options, printer, desc->enum_type(i)); - } - GenerateClassConstructor(options, printer, desc); - if (IsExtendable(desc) && desc->full_name() != "google.protobuf.bridge.MessageSet") { - GenerateClassExtensionFieldInfo(options, printer, desc); - } + GenerateClassConstructor(options, printer, desc); - GenerateClassExtensionDeclarations(options, printer, desc); - GenerateClassFieldInfo(options, printer, desc); GenerateClassFields(options, printer, desc); GenerateClassDeserializeBinary(options, printer, desc); GenerateClassSerializeBinary(options, printer, desc); @@ -2221,6 +2213,15 @@ void Generator::GenerateES6Class(const GeneratorOptions& options, printer->Outdent(); printer->Print("}\n\n"); + for (int i = 0; i < desc->enum_type_count(); i++) { + GenerateEnum(options, printer, desc->enum_type(i)); + } + if (IsExtendable(desc) && desc->full_name() != "google.protobuf.bridge.MessageSet") { + GenerateClassExtensionFieldInfo(options, printer, desc); + } + + GenerateClassExtensionDeclarations(options, printer, desc); + GenerateClassFieldInfo(options, printer, desc); GenerateClassToObject(options, printer, desc); GenerateClassExtensionRegistration(options, printer, desc); @@ -2257,17 +2258,12 @@ void Generator::GenerateClassFieldInfo(const GeneratorOptions& options, " * @private {!Array}\n" " * @const\n" " */\n"); - if (options.import_style == GeneratorOptions::kImportEs6) { - printer->Print("static repeatedFields_ = $rptfields$;\n\n", - "rptfields", RepeatedFieldNumberList(options, desc)); - } else { - printer->Print( - "$classname$$rptfieldarray$ = $rptfields$;\n" - "\n", - "classname", LocalMessageRef(options, desc), "rptfieldarray", - kRepeatedFieldArrayName, "rptfields", - RepeatedFieldNumberList(options, desc)); - } + printer->Print( + "$classname$$rptfieldarray$ = $rptfields$;\n" + "\n", + "classname", LocalMessageRef(options, desc), "rptfieldarray", + kRepeatedFieldArrayName, "rptfields", + RepeatedFieldNumberList(options, desc)); } if (HasOneofFields(desc)) { @@ -2284,15 +2280,10 @@ void Generator::GenerateClassFieldInfo(const GeneratorOptions& options, " * @private {!Array>}\n" " * @const\n" " */\n"); - if (options.import_style == GeneratorOptions::kImportEs6) { - printer->Print("static oneofGroups_ = $oneofgroups$;\n\n", - "oneofgroups", OneofGroupList(desc)); - } else { - printer->Print("$classname$$oneofgrouparray$ = $oneofgroups$;\n" - "\n", - "classname", LocalMessageRef(options, desc), "oneofgrouparray", - kOneofGroupArrayName, "oneofgroups", OneofGroupList(desc)); - } + printer->Print("$classname$$oneofgrouparray$ = $oneofgroups$;\n" + "\n", + "classname", LocalMessageRef(options, desc), "oneofgrouparray", + kOneofGroupArrayName, "oneofgroups", OneofGroupList(desc)); for (int i = 0; i < desc->oneof_decl_count(); i++) { if (IgnoreOneof(desc->oneof_decl(i))) { @@ -2321,14 +2312,10 @@ void Generator::GenerateOneofCaseDefinition( "/**\n" " * @enum {number}\n" " */\n"); - if (options.import_style == GeneratorOptions::kImportEs6) { - printer->Print("static $oneof$Case = {\n", - "oneof", JSOneofName(oneof)); - } else { - printer->Print("$classname$.$oneof$Case = {\n", - "classname", LocalMessageRef(options, oneof->containing_type()), - "oneof", JSOneofName(oneof)); - } + + printer->Print("$classname$.$oneof$Case = {\n", + "classname", LocalMessageRef(options, oneof->containing_type()), + "oneof", JSOneofName(oneof)); printer->Print(" $upcase$_NOT_SET: 0", "upcase", ToEnumCase(oneof->name())); for (int i = 0; i < oneof->field_count(); i++) { @@ -3297,13 +3284,10 @@ void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options, " *\n" " * @type {!Object}\n" " */\n"); - if (options.import_style == GeneratorOptions::kImportEs6) { - printer->Print("static extensions = {};\n\n"); - } else { - printer->Print("$class$.extensions = {};\n" - "\n", - "class", LocalMessageRef(options, desc)); - } + + printer->Print("$class$.extensions = {};\n" + "\n", + "class", LocalMessageRef(options, desc)); printer->Print( "\n" @@ -3322,13 +3306,10 @@ void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options, " *\n" " * @type {!Object}\n" " */\n"); - if (options.import_style == GeneratorOptions::kImportEs6) { - printer->Print("static extensionsBinary = {};\n\n"); - } else { - printer->Print("$class$.extensionsBinary = {};\n" - "\n", - "class", LocalMessageRef(options, desc)); - } + + printer->Print("$class$.extensionsBinary = {};\n" + "\n", + "class", LocalMessageRef(options, desc)); } } @@ -3689,9 +3670,6 @@ void Generator::GenerateEnum(const GeneratorOptions& options, if (IsExportedEnum(options, enumdesc)) { printer->Print("export const $enumname$ = {\n", "enumname", LocalEnumRef(options, enumdesc)); - } else if (options.import_style == GeneratorOptions::kImportEs6) { - printer->Print("static $enumname$ = {\n", - "enumname", enumdesc->name()); } else { printer->Print("$enumname$ = {\n", "enumname", LocalEnumRef(options, enumdesc)); @@ -3752,9 +3730,6 @@ void Generator::GenerateExtensionDeclaration( extension_scope = ""; printer->Print("export const $name$ = new jspb.ExtensionFieldInfo(\n", "name", extension_object_name); - } else if (options.import_style == GeneratorOptions::kImportEs6) { - printer->Print("static $name$ = new jspb.ExtensionFieldInfo(\n", - "name", extension_object_name); } else { extension_scope += "."; printer->Print("$class$$name$ = new jspb.ExtensionFieldInfo(\n", "class", From 1de37596bf8b607dbf791ef7cfce67e164bfc093 Mon Sep 17 00:00:00 2001 From: Jacob Fugal Date: Fri, 22 Aug 2025 11:07:18 -0600 Subject: [PATCH 10/12] fix oneOf getters, add ES6 class displayName --- example/test.d.ts | 148 ++++++ example/test.js | 947 ++++++++++++++++++++++++-------------- example/test2.d.ts | 12 + example/test2.js | 107 +++-- generator/js_generator.cc | 78 +++- generator/js_generator.h | 9 + 6 files changed, 899 insertions(+), 402 deletions(-) diff --git a/example/test.d.ts b/example/test.d.ts index 036bc3df..761cc25a 100644 --- a/example/test.d.ts +++ b/example/test.d.ts @@ -11,6 +11,10 @@ export class Empty extends jspb.Message { static serializeBinaryToWriter(message: Empty, writer: jspb.BinaryWriter): void; } +export declare namespace Empty { + const displayName: string | undefined; +} + export class EnumContainer extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -25,6 +29,10 @@ export class EnumContainer extends jspb.Message { hasOuterEnum(): boolean; } +export declare namespace EnumContainer { + const displayName: string | undefined; +} + export class Simple1 extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -47,6 +55,10 @@ export class Simple1 extends jspb.Message { hasABoolean(): boolean; } +export declare namespace Simple1 { + const displayName: string | undefined; +} + export class Simple2 extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -65,6 +77,10 @@ export class Simple2 extends jspb.Message { clearARepeatedStringList(): Simple2; } +export declare namespace Simple2 { + const displayName: string | undefined; +} + export class SpecialCases extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -91,6 +107,10 @@ export class SpecialCases extends jspb.Message { hasVar(): boolean; } +export declare namespace SpecialCases { + const displayName: string | undefined; +} + export class OptionalFields extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -121,6 +141,10 @@ export class OptionalFields extends jspb.Message { clearARepeatedStringList(): OptionalFields; } +export declare namespace OptionalFields { + const displayName: string | undefined; +} + export namespace OptionalFields { class Nested extends jspb.Message { constructor(data?: any[] | null); @@ -136,6 +160,10 @@ export namespace OptionalFields { hasAnInt(): boolean; } + namespace Nested { + const displayName: string | undefined; + } + } export class HasExtensions extends jspb.Message { @@ -160,6 +188,10 @@ export class HasExtensions extends jspb.Message { hasStr3(): boolean; } +export declare namespace HasExtensions { + const displayName: string | undefined; +} + export class Complex extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -194,6 +226,10 @@ export class Complex extends jspb.Message { hasAFloatingPointField(): boolean; } +export declare namespace Complex { + const displayName: string | undefined; +} + export namespace Complex { class Nested extends jspb.Message { constructor(data?: any[] | null); @@ -209,6 +245,10 @@ export namespace Complex { hasAnInt(): boolean; } + namespace Nested { + const displayName: string | undefined; + } + } export class OuterMessage extends jspb.Message { @@ -221,6 +261,10 @@ export class OuterMessage extends jspb.Message { static serializeBinaryToWriter(message: OuterMessage, writer: jspb.BinaryWriter): void; } +export declare namespace OuterMessage { + const displayName: string | undefined; +} + export namespace OuterMessage { class Complex extends jspb.Message { constructor(data?: any[] | null); @@ -236,6 +280,10 @@ export namespace OuterMessage { hasInnerComplexField(): boolean; } + namespace Complex { + const displayName: string | undefined; + } + } export class MineField extends jspb.Message { @@ -252,6 +300,10 @@ export class MineField extends jspb.Message { hasCookie(): boolean; } +export declare namespace MineField { + const displayName: string | undefined; +} + export class IsExtension extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -266,6 +318,10 @@ export class IsExtension extends jspb.Message { hasExt1(): boolean; } +export declare namespace IsExtension { + const displayName: string | undefined; +} + export class IndirectExtension extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -276,6 +332,10 @@ export class IndirectExtension extends jspb.Message { static serializeBinaryToWriter(message: IndirectExtension, writer: jspb.BinaryWriter): void; } +export declare namespace IndirectExtension { + const displayName: string | undefined; +} + export class DefaultValues extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -312,6 +372,10 @@ export class DefaultValues extends jspb.Message { hasBytesField(): boolean; } +export declare namespace DefaultValues { + const displayName: string | undefined; +} + export namespace DefaultValues { enum Enum { E1 = 13, @@ -362,6 +426,10 @@ export class FloatingPointFields extends jspb.Message { hasDefaultDoubleField(): boolean; } +export declare namespace FloatingPointFields { + const displayName: string | undefined; +} + export class BooleanFields extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -388,6 +456,10 @@ export class BooleanFields extends jspb.Message { hasDefaultBooleanField(): boolean; } +export declare namespace BooleanFields { + const displayName: string | undefined; +} + export class TestClone extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -420,6 +492,10 @@ export class TestClone extends jspb.Message { hasUnused(): boolean; } +export declare namespace TestClone { + const displayName: string | undefined; +} + export class TestCloneExtension extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -434,6 +510,10 @@ export class TestCloneExtension extends jspb.Message { hasF(): boolean; } +export declare namespace TestCloneExtension { + const displayName: string | undefined; +} + export class CloneExtension extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -448,6 +528,10 @@ export class CloneExtension extends jspb.Message { hasExt(): boolean; } +export declare namespace CloneExtension { + const displayName: string | undefined; +} + export class TestGroup extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -482,6 +566,10 @@ export class TestGroup extends jspb.Message { hasOptionalSimple(): boolean; } +export declare namespace TestGroup { + const displayName: string | undefined; +} + export namespace TestGroup { class RepeatedGroup extends jspb.Message { constructor(data?: any[] | null); @@ -501,6 +589,10 @@ export namespace TestGroup { clearSomeBoolList(): TestGroup.RepeatedGroup; } + namespace RepeatedGroup { + const displayName: string | undefined; + } + class RequiredGroup extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -515,6 +607,10 @@ export namespace TestGroup { hasId(): boolean; } + namespace RequiredGroup { + const displayName: string | undefined; + } + class OptionalGroup extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -529,6 +625,10 @@ export namespace TestGroup { hasId(): boolean; } + namespace OptionalGroup { + const displayName: string | undefined; + } + } export class TestGroup1 extends jspb.Message { @@ -545,6 +645,10 @@ export class TestGroup1 extends jspb.Message { hasGroup(): boolean; } +export declare namespace TestGroup1 { + const displayName: string | undefined; +} + export class TestReservedNames extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -559,6 +663,10 @@ export class TestReservedNames extends jspb.Message { hasExtension$(): boolean; } +export declare namespace TestReservedNames { + const displayName: string | undefined; +} + export class TestReservedNamesExtension extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -569,6 +677,10 @@ export class TestReservedNamesExtension extends jspb.Message { static serializeBinaryToWriter(message: TestReservedNamesExtension, writer: jspb.BinaryWriter): void; } +export declare namespace TestReservedNamesExtension { + const displayName: string | undefined; +} + export class TestMessageWithOneof extends jspb.Message { constructor(data?: any[] | null); getPartialOneofCase(): TestMessageWithOneof.PartialOneofCase; @@ -623,6 +735,10 @@ export class TestMessageWithOneof extends jspb.Message { hasBtwo(): boolean; } +export declare namespace TestMessageWithOneof { + const displayName: string | undefined; +} + export namespace TestMessageWithOneof { enum PartialOneofCase { PARTIAL_ONEOF_NOT_SET = 0, @@ -666,6 +782,10 @@ export class TestEndsWithBytes extends jspb.Message { hasData(): boolean; } +export declare namespace TestEndsWithBytes { + const displayName: string | undefined; +} + export class TestLastFieldBeforePivot extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -680,6 +800,10 @@ export class TestLastFieldBeforePivot extends jspb.Message { hasLastFieldBeforePivot(): boolean; } +export declare namespace TestLastFieldBeforePivot { + const displayName: string | undefined; +} + export class Int64Types extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -702,6 +826,10 @@ export class Int64Types extends jspb.Message { hasInt64Number(): boolean; } +export declare namespace Int64Types { + const displayName: string | undefined; +} + export class TestMapFieldsNoBinary extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -738,6 +866,10 @@ export class TestMapFieldsNoBinary extends jspb.Message { clearMapStringTestmapfieldsMap(): TestMapFieldsNoBinary; } +export declare namespace TestMapFieldsNoBinary { + const displayName: string | undefined; +} + export class MapValueMessageNoBinary extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -752,6 +884,10 @@ export class MapValueMessageNoBinary extends jspb.Message { hasFoo(): boolean; } +export declare namespace MapValueMessageNoBinary { + const displayName: string | undefined; +} + export class Deeply extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -762,6 +898,10 @@ export class Deeply extends jspb.Message { static serializeBinaryToWriter(message: Deeply, writer: jspb.BinaryWriter): void; } +export declare namespace Deeply { + const displayName: string | undefined; +} + export namespace Deeply { class Nested extends jspb.Message { constructor(data?: any[] | null); @@ -773,6 +913,10 @@ export namespace Deeply { static serializeBinaryToWriter(message: Deeply.Nested, writer: jspb.BinaryWriter): void; } + namespace Nested { + const displayName: string | undefined; + } + namespace Nested { class Message extends jspb.Message { constructor(data?: any[] | null); @@ -788,6 +932,10 @@ export namespace Deeply { hasCount(): boolean; } + namespace Message { + const displayName: string | undefined; + } + } } diff --git a/example/test.js b/example/test.js index a78b63c7..72ef8897 100644 --- a/example/test.js +++ b/example/test.js @@ -90,6 +90,13 @@ export class Empty extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + Empty.displayName = 'proto.jspb.test.Empty'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -253,6 +260,13 @@ export class EnumContainer extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + EnumContainer.displayName = 'proto.jspb.test.EnumContainer'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -309,13 +323,6 @@ export class Simple1 extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, Simple1.repeatedFields_, null); }; - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ - static repeatedFields_ = [2]; - /** * required string a_string = 1; * @return {string} @@ -518,6 +525,20 @@ export class Simple1 extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + Simple1.displayName = 'proto.jspb.test.Simple1'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +Simple1.repeatedFields_ = [2]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -576,13 +597,6 @@ export class Simple2 extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, Simple2.repeatedFields_, null); }; - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ - static repeatedFields_ = [2]; - /** * required string a_string = 1; * @return {string} @@ -738,6 +752,20 @@ export class Simple2 extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + Simple2.displayName = 'proto.jspb.test.Simple2'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +Simple2.repeatedFields_ = [2]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -1043,6 +1071,13 @@ export class SpecialCases extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + SpecialCases.displayName = 'proto.jspb.test.SpecialCases'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -1102,13 +1137,6 @@ export class OptionalFields extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, OptionalFields.repeatedFields_, null); }; - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ - static repeatedFields_ = [4,5]; - /** * optional string a_string = 1; * @return {string} @@ -1412,6 +1440,20 @@ export class OptionalFields extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + OptionalFields.displayName = 'proto.jspb.test.OptionalFields'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +OptionalFields.repeatedFields_ = [4,5]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -1580,6 +1622,13 @@ OptionalFields.Nested = class extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + OptionalFields.Nested.displayName = 'proto.jspb.test.OptionalFields.Nested'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -1636,36 +1685,6 @@ export class HasExtensions extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, 4, null, null); }; - - /** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ - static extensions = {}; - - - /** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ - static extensionsBinary = {}; - /** * optional string str1 = 1; * @return {string} @@ -1872,6 +1891,43 @@ export class HasExtensions extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + HasExtensions.displayName = 'proto.jspb.test.HasExtensions'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +HasExtensions.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +HasExtensions.extensionsBinary = {}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -1933,13 +1989,6 @@ export class Complex extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, Complex.repeatedFields_, null); }; - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ - static repeatedFields_ = [5,7]; - /** * required string a_string = 1; * @return {string} @@ -2290,6 +2339,20 @@ export class Complex extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + Complex.displayName = 'proto.jspb.test.Complex'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +Complex.repeatedFields_ = [5,7]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -2459,6 +2522,13 @@ Complex.Nested = class extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + Complex.Nested.displayName = 'proto.jspb.test.Complex.Nested'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -2575,6 +2645,13 @@ export class OuterMessage extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + OuterMessage.displayName = 'proto.jspb.test.OuterMessage'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -2738,6 +2815,13 @@ OuterMessage.Complex = class extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + OuterMessage.Complex.displayName = 'proto.jspb.test.OuterMessage.Complex'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -2901,6 +2985,13 @@ export class MineField extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + MineField.displayName = 'proto.jspb.test.MineField'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -2957,19 +3048,6 @@ export class IsExtension extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; - - /** - * A tuple of {field number, class constructor} for the extension - * field named `extField`. - * @type {!jspb.ExtensionFieldInfo} - */ - static extField = new jspb.ExtensionFieldInfo( - 100, - {extField: 0}, - IsExtension, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - IsExtension.toObject), - 0); /** * optional string ext1 = 1; * @return {string} @@ -3077,6 +3155,26 @@ export class IsExtension extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + IsExtension.displayName = 'proto.jspb.test.IsExtension'; +} + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +IsExtension.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + IsExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + IsExtension.toObject), + 0); if (jspb.Message.GENERATE_TO_OBJECT) { @@ -3145,58 +3243,6 @@ export class IndirectExtension extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; - - /** - * A tuple of {field number, class constructor} for the extension - * field named `simple`. - * @type {!jspb.ExtensionFieldInfo} - */ - static simple = new jspb.ExtensionFieldInfo( - 101, - {simple: 0}, - Simple1, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - Simple1.toObject), - 0); - - /** - * A tuple of {field number, class constructor} for the extension - * field named `str`. - * @type {!jspb.ExtensionFieldInfo} - */ - static str = new jspb.ExtensionFieldInfo( - 102, - {str: 0}, - null, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - null), - 0); - - /** - * A tuple of {field number, class constructor} for the extension - * field named `repeatedStrList`. - * @type {!jspb.ExtensionFieldInfo>} - */ - static repeatedStrList = new jspb.ExtensionFieldInfo( - 103, - {repeatedStrList: 0}, - null, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - null), - 1); - - /** - * A tuple of {field number, class constructor} for the extension - * field named `repeatedSimpleList`. - * @type {!jspb.ExtensionFieldInfo>} - */ - static repeatedSimpleList = new jspb.ExtensionFieldInfo( - 104, - {repeatedSimpleList: 0}, - Simple1, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - Simple1.toObject), - 1); /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. @@ -3257,6 +3303,65 @@ export class IndirectExtension extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + IndirectExtension.displayName = 'proto.jspb.test.IndirectExtension'; +} + +/** + * A tuple of {field number, class constructor} for the extension + * field named `simple`. + * @type {!jspb.ExtensionFieldInfo} + */ +IndirectExtension.simple = new jspb.ExtensionFieldInfo( + 101, + {simple: 0}, + Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + Simple1.toObject), + 0); + +/** + * A tuple of {field number, class constructor} for the extension + * field named `str`. + * @type {!jspb.ExtensionFieldInfo} + */ +IndirectExtension.str = new jspb.ExtensionFieldInfo( + 102, + {str: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); + +/** + * A tuple of {field number, class constructor} for the extension + * field named `repeatedStrList`. + * @type {!jspb.ExtensionFieldInfo>} + */ +IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( + 103, + {repeatedStrList: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 1); + +/** + * A tuple of {field number, class constructor} for the extension + * field named `repeatedSimpleList`. + * @type {!jspb.ExtensionFieldInfo>} + */ +IndirectExtension.repeatedSimpleList = new jspb.ExtensionFieldInfo( + 104, + {repeatedSimpleList: 0}, + Simple1, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + Simple1.toObject), + 1); if (jspb.Message.GENERATE_TO_OBJECT) { @@ -3348,14 +3453,6 @@ HasExtensions.extensionsBinary[104] = new jspb.ExtensionFieldBinaryInfo( HasExtensions.extensions[104] = IndirectExtension.repeatedSimpleList; export class DefaultValues extends jspb.Message { - /** - * @enum {number} - */ - static Enum = { - E1: 13, - E2: 77 - }; - /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -3735,6 +3832,21 @@ export class DefaultValues extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + DefaultValues.displayName = 'proto.jspb.test.DefaultValues'; +} +/** + * @enum {number} + */ +DefaultValues.Enum = { + E1: 13, + E2: 77 +}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -3796,13 +3908,6 @@ export class FloatingPointFields extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, FloatingPointFields.repeatedFields_, null); }; - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ - static repeatedFields_ = [3,7]; - /** * optional float optional_float_field = 1; * @return {number} @@ -4245,6 +4350,20 @@ export class FloatingPointFields extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + FloatingPointFields.displayName = 'proto.jspb.test.FloatingPointFields'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +FloatingPointFields.repeatedFields_ = [3,7]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -4308,13 +4427,6 @@ export class BooleanFields extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, BooleanFields.repeatedFields_, null); }; - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ - static repeatedFields_ = [3]; - /** * optional bool optional_boolean_field = 1; * @return {boolean} @@ -4566,6 +4678,20 @@ export class BooleanFields extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + BooleanFields.displayName = 'proto.jspb.test.BooleanFields'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +BooleanFields.repeatedFields_ = [3]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -4625,43 +4751,6 @@ export class TestClone extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, 8, TestClone.repeatedFields_, null); }; - - /** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ - static extensions = {}; - - - /** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ - static extensionsBinary = {}; - - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ - static repeatedFields_ = [5]; - /** * optional string str = 1; * @return {string} @@ -4993,6 +5082,50 @@ export class TestClone extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestClone.displayName = 'proto.jspb.test.TestClone'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +TestClone.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +TestClone.extensionsBinary = {}; + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +TestClone.repeatedFields_ = [5]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -5057,19 +5190,6 @@ export class TestCloneExtension extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; - - /** - * A tuple of {field number, class constructor} for the extension - * field named `lowExt`. - * @type {!jspb.ExtensionFieldInfo} - */ - static lowExt = new jspb.ExtensionFieldInfo( - 11, - {lowExt: 0}, - TestCloneExtension, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - TestCloneExtension.toObject), - 0); /** * optional int32 f = 1; * @return {number} @@ -5177,6 +5297,26 @@ export class TestCloneExtension extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestCloneExtension.displayName = 'proto.jspb.test.TestCloneExtension'; +} + +/** + * A tuple of {field number, class constructor} for the extension + * field named `lowExt`. + * @type {!jspb.ExtensionFieldInfo} + */ +TestCloneExtension.lowExt = new jspb.ExtensionFieldInfo( + 11, + {lowExt: 0}, + TestCloneExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + TestCloneExtension.toObject), + 0); if (jspb.Message.GENERATE_TO_OBJECT) { @@ -5245,19 +5385,6 @@ export class CloneExtension extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; - - /** - * A tuple of {field number, class constructor} for the extension - * field named `extField`. - * @type {!jspb.ExtensionFieldInfo} - */ - static extField = new jspb.ExtensionFieldInfo( - 100, - {extField: 0}, - CloneExtension, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - CloneExtension.toObject), - 0); /** * optional string ext = 2; * @return {string} @@ -5365,6 +5492,26 @@ export class CloneExtension extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + CloneExtension.displayName = 'proto.jspb.test.CloneExtension'; +} + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +CloneExtension.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + CloneExtension, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + CloneExtension.toObject), + 0); if (jspb.Message.GENERATE_TO_OBJECT) { @@ -5433,13 +5580,6 @@ export class TestGroup extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, TestGroup.repeatedFields_, null); }; - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ - static repeatedFields_ = [1]; - /** * repeated group RepeatedGroup = 1; * @return {!Array} @@ -5798,6 +5938,20 @@ export class TestGroup extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestGroup.displayName = 'proto.jspb.test.TestGroup'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +TestGroup.repeatedFields_ = [1]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -5860,13 +6014,6 @@ TestGroup.RepeatedGroup = class extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, TestGroup.RepeatedGroup.repeatedFields_, null); }; - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ - static repeatedFields_ = [1]; - /** * required string id = 1; * @return {string} @@ -6024,6 +6171,20 @@ TestGroup.RepeatedGroup = class extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestGroup.RepeatedGroup.displayName = 'proto.jspb.test.TestGroup.RepeatedGroup'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +TestGroup.RepeatedGroup.repeatedFields_ = [1]; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -6188,6 +6349,13 @@ TestGroup.RequiredGroup = class extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestGroup.RequiredGroup.displayName = 'proto.jspb.test.TestGroup.RequiredGroup'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -6351,6 +6519,13 @@ TestGroup.OptionalGroup = class extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestGroup.OptionalGroup.displayName = 'proto.jspb.test.TestGroup.OptionalGroup'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -6517,6 +6692,13 @@ export class TestGroup1 extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestGroup1.displayName = 'proto.jspb.test.TestGroup1'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -6573,36 +6755,6 @@ export class TestReservedNames extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, 2, null, null); }; - - /** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ - static extensions = {}; - - - /** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ - static extensionsBinary = {}; - /** * optional int32 extension = 1; * @return {number} @@ -6715,6 +6867,43 @@ export class TestReservedNames extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestReservedNames.displayName = 'proto.jspb.test.TestReservedNames'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +TestReservedNames.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +TestReservedNames.extensionsBinary = {}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -6774,19 +6963,6 @@ export class TestReservedNamesExtension extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; - - /** - * A tuple of {field number, class constructor} for the extension - * field named `foo`. - * @type {!jspb.ExtensionFieldInfo} - */ - static foo = new jspb.ExtensionFieldInfo( - 10, - {foo: 0}, - null, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - null), - 0); /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. @@ -6847,6 +7023,26 @@ export class TestReservedNamesExtension extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestReservedNamesExtension.displayName = 'proto.jspb.test.TestReservedNamesExtension'; +} + +/** + * A tuple of {field number, class constructor} for the extension + * field named `foo`. + * @type {!jspb.ExtensionFieldInfo} + */ +TestReservedNamesExtension.foo = new jspb.ExtensionFieldInfo( + 10, + {foo: 0}, + null, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + null), + 0); if (jspb.Message.GENERATE_TO_OBJECT) { @@ -6915,31 +7111,6 @@ export class TestMessageWithOneof extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, TestMessageWithOneof.repeatedFields_, TestMessageWithOneof.oneofGroups_); }; - /** - * List of repeated fields within this message type. - * @private {!Array} - * @const - */ - static repeatedFields_ = [9]; - - /** - * Oneof group definitions for this message. Each group defines the field - * numbers belonging to that group. When of these fields' value is set, all - * other fields in the group are cleared. During deserialization, if multiple - * fields are encountered for a group, only the last value seen will be kept. - * @private {!Array>} - * @const - */ - static oneofGroups_ = [[3,5],[6,7],[10,11],[12,13]]; - - /** - * @enum {number} - */ - static PartialOneofCase = { - PARTIAL_ONEOF_NOT_SET: 0, - PONE: 3, - PTHREE: 5 - }; /** * @return {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} @@ -6948,14 +7119,6 @@ export class TestMessageWithOneof extends jspb.Message { return /** @type {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[0])); }; - /** - * @enum {number} - */ - static RecursiveOneofCase = { - RECURSIVE_ONEOF_NOT_SET: 0, - RONE: 6, - RTWO: 7 - }; /** * @return {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} @@ -6964,14 +7127,6 @@ export class TestMessageWithOneof extends jspb.Message { return /** @type {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[1])); }; - /** - * @enum {number} - */ - static DefaultOneofACase = { - DEFAULT_ONEOF_A_NOT_SET: 0, - AONE: 10, - ATWO: 11 - }; /** * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} @@ -6980,14 +7135,6 @@ export class TestMessageWithOneof extends jspb.Message { return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[2])); }; - /** - * @enum {number} - */ - static DefaultOneofBCase = { - DEFAULT_ONEOF_B_NOT_SET: 0, - BONE: 12, - BTWO: 13 - }; /** * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} @@ -7530,6 +7677,62 @@ export class TestMessageWithOneof extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestMessageWithOneof.displayName = 'proto.jspb.test.TestMessageWithOneof'; +} +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +TestMessageWithOneof.repeatedFields_ = [9]; + +/** + * Oneof group definitions for this message. Each group defines the field + * numbers belonging to that group. When of these fields' value is set, all + * other fields in the group are cleared. During deserialization, if multiple + * fields are encountered for a group, only the last value seen will be kept. + * @private {!Array>} + * @const + */ +TestMessageWithOneof.oneofGroups_ = [[3,5],[6,7],[10,11],[12,13]]; + +/** + * @enum {number} + */ +TestMessageWithOneof.PartialOneofCase = { + PARTIAL_ONEOF_NOT_SET: 0, + PONE: 3, + PTHREE: 5 +}; +/** + * @enum {number} + */ +TestMessageWithOneof.RecursiveOneofCase = { + RECURSIVE_ONEOF_NOT_SET: 0, + RONE: 6, + RTWO: 7 +}; +/** + * @enum {number} + */ +TestMessageWithOneof.DefaultOneofACase = { + DEFAULT_ONEOF_A_NOT_SET: 0, + AONE: 10, + ATWO: 11 +}; +/** + * @enum {number} + */ +TestMessageWithOneof.DefaultOneofBCase = { + DEFAULT_ONEOF_B_NOT_SET: 0, + BONE: 12, + BTWO: 13 +}; if (jspb.Message.GENERATE_TO_OBJECT) { @@ -7773,6 +7976,13 @@ export class TestEndsWithBytes extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestEndsWithBytes.displayName = 'proto.jspb.test.TestEndsWithBytes'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -7830,36 +8040,6 @@ export class TestLastFieldBeforePivot extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, 2, null, null); }; - - /** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ - static extensions = {}; - - - /** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ - static extensionsBinary = {}; - /** * optional int32 last_field_before_pivot = 1; * @return {number} @@ -7972,6 +8152,43 @@ export class TestLastFieldBeforePivot extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestLastFieldBeforePivot.displayName = 'proto.jspb.test.TestLastFieldBeforePivot'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +TestLastFieldBeforePivot.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +TestLastFieldBeforePivot.extensionsBinary = {}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -8232,6 +8449,13 @@ export class Int64Types extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + Int64Types.displayName = 'proto.jspb.test.Int64Types'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -8763,6 +8987,13 @@ export class TestMapFieldsNoBinary extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestMapFieldsNoBinary.displayName = 'proto.jspb.test.TestMapFieldsNoBinary'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -8937,6 +9168,13 @@ export class MapValueMessageNoBinary extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + MapValueMessageNoBinary.displayName = 'proto.jspb.test.MapValueMessageNoBinary'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -9053,6 +9291,13 @@ export class Deeply extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + Deeply.displayName = 'proto.jspb.test.Deeply'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -9169,6 +9414,13 @@ Deeply.Nested = class extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + Deeply.Nested.displayName = 'proto.jspb.test.Deeply.Nested'; +} if (jspb.Message.GENERATE_TO_OBJECT) { @@ -9332,6 +9584,13 @@ Deeply.Nested.Message = class extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + Deeply.Nested.Message.displayName = 'proto.jspb.test.Deeply.Nested.Message'; +} if (jspb.Message.GENERATE_TO_OBJECT) { diff --git a/example/test2.d.ts b/example/test2.d.ts index acdc5e1c..d9a3a0b4 100644 --- a/example/test2.d.ts +++ b/example/test2.d.ts @@ -20,6 +20,10 @@ export class TestExtensionsMessage extends jspb.Message { hasIntfield(): boolean; } +export declare namespace TestExtensionsMessage { + const displayName: string | undefined; +} + export class ExtensionMessage extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -34,6 +38,10 @@ export class ExtensionMessage extends jspb.Message { hasExt1(): boolean; } +export declare namespace ExtensionMessage { + const displayName: string | undefined; +} + export class ForeignNestedFieldMessage extends jspb.Message { constructor(data?: any[] | null); toObject(includeInstance?: boolean): { [key: string]: unknown }; @@ -48,3 +56,7 @@ export class ForeignNestedFieldMessage extends jspb.Message { hasDeeplyNestedMessage(): boolean; } +export declare namespace ForeignNestedFieldMessage { + const displayName: string | undefined; +} + diff --git a/example/test2.js b/example/test2.js index 556beb31..4b2bfd2f 100644 --- a/example/test2.js +++ b/example/test2.js @@ -30,36 +30,6 @@ export class TestExtensionsMessage extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, 2, null, null); }; - - /** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ - static extensions = {}; - - - /** - * The extensions registered with this message class. This is a map of - * extension field number to fieldInfo object. - * - * For example: - * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } - * - * fieldName contains the JsCompiler renamed field name property so that it - * works in OPTIMIZED mode. - * - * @type {!Object} - */ - static extensionsBinary = {}; - /** * optional int32 intfield = 1; * @return {number} @@ -172,6 +142,43 @@ export class TestExtensionsMessage extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + TestExtensionsMessage.displayName = 'proto.jspb.test.TestExtensionsMessage'; +} + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +TestExtensionsMessage.extensions = {}; + + +/** + * The extensions registered with this message class. This is a map of + * extension field number to fieldInfo object. + * + * For example: + * { 123: {fieldIndex: 123, fieldName: {my_field_name: 0}, ctor: proto.example.MyMessage} } + * + * fieldName contains the JsCompiler renamed field name property so that it + * works in OPTIMIZED mode. + * + * @type {!Object} + */ +TestExtensionsMessage.extensionsBinary = {}; + if (jspb.Message.GENERATE_TO_OBJECT) { @@ -231,19 +238,6 @@ export class ExtensionMessage extends jspb.Message { constructor(opt_data) { jspb.Message.initialize(this, opt_data, 0, -1, null, null); }; - - /** - * A tuple of {field number, class constructor} for the extension - * field named `extField`. - * @type {!jspb.ExtensionFieldInfo} - */ - static extField = new jspb.ExtensionFieldInfo( - 100, - {extField: 0}, - ExtensionMessage, - /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( - ExtensionMessage.toObject), - 0); /** * optional string ext1 = 1; * @return {string} @@ -351,6 +345,26 @@ export class ExtensionMessage extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + ExtensionMessage.displayName = 'proto.jspb.test.ExtensionMessage'; +} + +/** + * A tuple of {field number, class constructor} for the extension + * field named `extField`. + * @type {!jspb.ExtensionFieldInfo} + */ +ExtensionMessage.extField = new jspb.ExtensionFieldInfo( + 100, + {extField: 0}, + ExtensionMessage, + /** @type {?function((boolean|undefined),!jspb.Message=): !Object} */ ( + ExtensionMessage.toObject), + 0); if (jspb.Message.GENERATE_TO_OBJECT) { @@ -529,6 +543,13 @@ export class ForeignNestedFieldMessage extends jspb.Message { } +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + ForeignNestedFieldMessage.displayName = 'proto.jspb.test.ForeignNestedFieldMessage'; +} if (jspb.Message.GENERATE_TO_OBJECT) { diff --git a/generator/js_generator.cc b/generator/js_generator.cc index 11ac4e11..a10fa605 100644 --- a/generator/js_generator.cc +++ b/generator/js_generator.cc @@ -2169,22 +2169,28 @@ void Generator::GenerateClassConstructor(const GeneratorOptions& options, OneofFieldsArrayName(options, desc)); printer->Print("};\n"); if (options.import_style != GeneratorOptions::kImportEs6) { - printer->Print( - "goog.inherits($classname$, jspb.Message);\n" - "if (goog.DEBUG && !COMPILED) {\n" - // displayName overrides Function.prototype.displayName - // http://google3/javascript/externs/es3.js?l=511 - " /**\n" - " * @public\n" - " * @override\n" - " */\n" - " $classname$.displayName = '$displayname$';\n" - "}\n", - "classname", LocalMessageRef(options, desc), "displayname", - GetQualifiedMessagePath(options, desc)); + printer->Print("goog.inherits($classname$, jspb.Message);\n", + "classname", LocalMessageRef(options, desc)); } } +void Generator::GenerateDisplayName(const GeneratorOptions& options, + io::Printer* printer, + const Descriptor* desc) const { + printer->Print( + "if (goog.DEBUG && !COMPILED) {\n" + // displayName overrides Function.prototype.displayName + // http://google3/javascript/externs/es3.js?l=511 + " /**\n" + " * @public\n" + " * @override\n" + " */\n" + " $classname$.displayName = '$displayname$';\n" + "}\n", + "classname", LocalMessageRef(options, desc), "displayname", + GetQualifiedMessagePath(options, desc)); +} + void Generator::GenerateES6Class(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const { @@ -2206,6 +2212,7 @@ void Generator::GenerateES6Class(const GeneratorOptions& options, GenerateClassConstructor(options, printer, desc); + GenerateES6OneOfCaseGetters(options, printer, desc); GenerateClassFields(options, printer, desc); GenerateClassDeserializeBinary(options, printer, desc); GenerateClassSerializeBinary(options, printer, desc); @@ -2213,6 +2220,8 @@ void Generator::GenerateES6Class(const GeneratorOptions& options, printer->Outdent(); printer->Print("}\n\n"); + GenerateDisplayName(options, printer, desc); + for (int i = 0; i < desc->enum_type_count(); i++) { GenerateEnum(options, printer, desc->enum_type(i)); } @@ -2235,6 +2244,8 @@ void Generator::GenerateClassConstructorAndDeclareExtensionFieldInfo( const Descriptor* desc) const { if (!NamespaceOnly(desc)) { GenerateClassConstructor(options, printer, desc); + GenerateDisplayName(options, printer, desc); + if (IsExtendable(desc) && desc->full_name() != "google.protobuf.bridge.MessageSet") { GenerateClassExtensionFieldInfo(options, printer, desc); @@ -2290,6 +2301,10 @@ void Generator::GenerateClassFieldInfo(const GeneratorOptions& options, continue; } GenerateOneofCaseDefinition(options, printer, desc->oneof_decl(i)); + // ES6 getters were already generated by GenerateES6OneOfCaseGetters inside the class + if (options.import_style != GeneratorOptions::kImportEs6) { + GenerateOneofCaseGetter(options, printer, desc->oneof_decl(i)); + } } } } @@ -2330,10 +2345,13 @@ void Generator::GenerateOneofCaseDefinition( JSFieldIndex(oneof->field(i))); printer->Annotate("upcase", oneof->field(i)); } + printer->Print("\n};\n"); +} +void Generator::GenerateOneofCaseGetter( + const GeneratorOptions& options, io::Printer* printer, + const OneofDescriptor* oneof) const { printer->Print( - "\n" - "};\n" "\n" "/**\n" " * @return {$type$.$oneof$Case}\n" @@ -2358,6 +2376,19 @@ void Generator::GenerateOneofCaseDefinition( JSOneofName(oneof), "oneofindex", JSOneofIndex(oneof)); } +void Generator::GenerateES6OneOfCaseGetters(const GeneratorOptions& options, + io::Printer* printer, + const Descriptor* desc) const { + if (HasOneofFields(desc)) { + for (int i = 0; i < desc->oneof_decl_count(); i++) { + if (IgnoreOneof(desc->oneof_decl(i))) { + continue; + } + GenerateOneofCaseGetter(options, printer, desc->oneof_decl(i)); + } + } +} + void Generator::GenerateClassToObject(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const { @@ -4226,6 +4257,23 @@ void Generator::GenerateMessageDTS(const GeneratorOptions& options, printer->Outdent(); printer->Print("}\n\n"); + // ClassName.displayName + if (IsExportedMessage(options, desc)) { + printer->Print("$prefix$declare namespace $classname$ {\n", + "classname", LocalMessageRef(options, desc), "prefix", prefix); + printer->Indent(); + printer->Print("const displayName: string | undefined;\n"); + printer->Outdent(); + printer->Print("}\n\n"); + } else { + printer->Print("namespace $classname$ {\n", + "classname", desc->name(), "prefix", prefix); + printer->Indent(); + printer->Print("const displayName: string | undefined;\n"); + printer->Outdent(); + printer->Print("}\n\n"); + } + bool has_subtypes = false; if (HasOneofFields(desc)) { for (int i = 0; i < desc->oneof_decl_count(); i++) { diff --git a/generator/js_generator.h b/generator/js_generator.h index 1b297fbd..9dea9eeb 100644 --- a/generator/js_generator.h +++ b/generator/js_generator.h @@ -282,6 +282,9 @@ class Generator : public CodeGenerator { void GenerateClassConstructor(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const; + void GenerateDisplayName(const GeneratorOptions& options, + io::Printer* printer, + const Descriptor* desc) const; void GenerateClassFieldInfo(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const; @@ -293,6 +296,12 @@ class Generator : public CodeGenerator { void GenerateOneofCaseDefinition(const GeneratorOptions& options, io::Printer* printer, const OneofDescriptor* oneof) const; + void GenerateOneofCaseGetter(const GeneratorOptions& options, + io::Printer* printer, + const OneofDescriptor* oneof) const; + void GenerateES6OneOfCaseGetters(const GeneratorOptions& options, + io::Printer* printer, + const Descriptor* desc) const; void GenerateObjectTypedef(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const; From 68063212a2e29f8417942df3ce5a9efc6082dcea Mon Sep 17 00:00:00 2001 From: Jacob Fugal Date: Fri, 22 Aug 2025 11:29:05 -0600 Subject: [PATCH 11/12] fix goog import, remove proto, fix typo in repeated helpers --- example/README.md | 27 ++++++++++++++------------- example/test.closure-new.js | 8 ++++---- example/test.closure.diff | 16 ++++++++++++++++ example/test.js | 11 +++++------ example/test2.js | 3 +-- generator/js_generator.cc | 10 +++++----- 6 files changed, 45 insertions(+), 30 deletions(-) diff --git a/example/README.md b/example/README.md index 0e34ce30..77888207 100644 --- a/example/README.md +++ b/example/README.md @@ -9,21 +9,22 @@ protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. - ``` Generates all of: -* `example/test.js` -* `example/test2.js` -* `example/test.d.ts` -* `example/test2.d.ts` -The `*.js` files are generated with ES6-style imports/exports. The `*.d.ts` files have TypeScript definitions for their respective `.js` files. The `test2.*` files demonstrate dependency between generated files. +- `example/test.js` +- `example/test2.js` +- `example/test.d.ts` +- `example/test2.d.ts` + +The `*.js` files are generated with ES6-style imports/exports. The `*.d.ts` files have TypeScript definitions for their respective `.js` files. The `test2.*` files demonstrate dependency between generated files. To regression test Closure output: ``` git checkout origin/main bazel build generator:protoc-gen-js -protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test,import_style=closure,binary:. protos/test.proto +protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test,import_style=closure,binary:. protos/test.proto mv example/test.js example-test.js -protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test2,import_style=closure,binary:. protos/test2.proto +protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test2,import_style=closure,binary:. protos/test2.proto mv example/test2.js example-test2.js rmdir example @@ -31,11 +32,11 @@ git checkout lukfugl/es6 bazel build generator:protoc-gen-js mv example-test.js example/test.closure-old.js mv example-test2.js example/test2.closure-old.js -protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test,import_style=closure,binary:. protos/test.proto -mv example/test.js example/test.closure-new.js -protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test2,import_style=closure,binary:. protos/test2.proto -mv example/test2.js example/test2.closure-new.js +protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test,import_style=closure,binary:. protos/test.proto +mv example/test.js example/test.closure-new.js +protoc --plugin=protoc-gen-js=bazel-bin/generator/protoc-gen-js --proto_path=. --js_out=output_dir=example,library=test2,import_style=closure,binary:. protos/test2.proto +mv example/test2.js example/test2.closure-new.js -diff example/test.closure-* > example/test.closure.diff # empty +diff example/test.closure-* > example/test.closure.diff # typo fix only diff example/test2.closure-* > example/test2.closure.diff # empty -``` \ No newline at end of file +``` diff --git a/example/test.closure-new.js b/example/test.closure-new.js index 7610c519..a02f124a 100644 --- a/example/test.closure-new.js +++ b/example/test.closure-new.js @@ -2410,7 +2410,7 @@ proto.jspb.test.OptionalFields.prototype.setARepeatedMessageList = function(valu /** - * @param {!proto.jspb.test.OptionalFields.Nested=} opt_value + * @param {!proto.jspb.test.OptionalFields.Nested} opt_value * @param {number=} opt_index * @return {!proto.jspb.test.OptionalFields.Nested} */ @@ -3178,7 +3178,7 @@ proto.jspb.test.Complex.prototype.setARepeatedMessageList = function(value) { /** - * @param {!proto.jspb.test.Complex.Nested=} opt_value + * @param {!proto.jspb.test.Complex.Nested} opt_value * @param {number=} opt_index * @return {!proto.jspb.test.Complex.Nested} */ @@ -5532,7 +5532,7 @@ proto.jspb.test.TestClone.prototype.setSimple2List = function(value) { /** - * @param {!proto.jspb.test.Simple1=} opt_value + * @param {!proto.jspb.test.Simple1} opt_value * @param {number=} opt_index * @return {!proto.jspb.test.Simple1} */ @@ -6704,7 +6704,7 @@ proto.jspb.test.TestGroup.prototype.setRepeatedGroupList = function(value) { /** - * @param {!proto.jspb.test.TestGroup.RepeatedGroup=} opt_value + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} opt_value * @param {number=} opt_index * @return {!proto.jspb.test.TestGroup.RepeatedGroup} */ diff --git a/example/test.closure.diff b/example/test.closure.diff index e69de29b..c93ff92a 100644 --- a/example/test.closure.diff +++ b/example/test.closure.diff @@ -0,0 +1,16 @@ +2413c2413 +< * @param {!proto.jspb.test.OptionalFields.Nested} opt_value +--- +> * @param {!proto.jspb.test.OptionalFields.Nested=} opt_value +3181c3181 +< * @param {!proto.jspb.test.Complex.Nested} opt_value +--- +> * @param {!proto.jspb.test.Complex.Nested=} opt_value +5535c5535 +< * @param {!proto.jspb.test.Simple1} opt_value +--- +> * @param {!proto.jspb.test.Simple1=} opt_value +6707c6707 +< * @param {!proto.jspb.test.TestGroup.RepeatedGroup} opt_value +--- +> * @param {!proto.jspb.test.TestGroup.RepeatedGroup=} opt_value diff --git a/example/test.js b/example/test.js index 72ef8897..e04a6b5d 100644 --- a/example/test.js +++ b/example/test.js @@ -12,8 +12,7 @@ // @ts-nocheck import * as jspb from 'google-protobuf'; -var goog = jspb; -var proto = {}; +import * as goog from 'closure-library/closure/goog'; import * as google_protobuf_descriptor_pb from 'google-protobuf/google/protobuf/descriptor.js'; export class Empty extends jspb.Message { @@ -1266,7 +1265,7 @@ export class OptionalFields extends jspb.Message { /** - * @param {!proto.jspb.test.OptionalFields.Nested=} opt_value + * @param {!proto.jspb.test.OptionalFields.Nested} opt_value * @param {number=} opt_index * @return {!proto.jspb.test.OptionalFields.Nested} */ @@ -2118,7 +2117,7 @@ export class Complex extends jspb.Message { /** - * @param {!proto.jspb.test.Complex.Nested=} opt_value + * @param {!proto.jspb.test.Complex.Nested} opt_value * @param {number=} opt_index * @return {!proto.jspb.test.Complex.Nested} */ @@ -4844,7 +4843,7 @@ export class TestClone extends jspb.Message { /** - * @param {!proto.jspb.test.Simple1=} opt_value + * @param {!proto.jspb.test.Simple1} opt_value * @param {number=} opt_index * @return {!proto.jspb.test.Simple1} */ @@ -5600,7 +5599,7 @@ export class TestGroup extends jspb.Message { /** - * @param {!proto.jspb.test.TestGroup.RepeatedGroup=} opt_value + * @param {!proto.jspb.test.TestGroup.RepeatedGroup} opt_value * @param {number=} opt_index * @return {!proto.jspb.test.TestGroup.RepeatedGroup} */ diff --git a/example/test2.js b/example/test2.js index 4b2bfd2f..4d9ca998 100644 --- a/example/test2.js +++ b/example/test2.js @@ -12,8 +12,7 @@ // @ts-nocheck import * as jspb from 'google-protobuf'; -var goog = jspb; -var proto = {}; +import * as goog from 'closure-library/closure/goog'; import * as protos_test_pb from '../protos/test.js'; export class TestExtensionsMessage extends jspb.Message { diff --git a/generator/js_generator.cc b/generator/js_generator.cc index a10fa605..ac19ee53 100644 --- a/generator/js_generator.cc +++ b/generator/js_generator.cc @@ -3265,7 +3265,7 @@ void Generator::GenerateRepeatedMessageHelperMethods( std::string addername = "add" + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list = */ true); printer->Print( "/**\n" - " * @param {$optionaltype$=} opt_value\n" + " * @param {$optionaltype$} opt_value\n" " * @param {number=} opt_index\n" " * @return {$optionaltype$}\n" " */\n", @@ -4039,16 +4039,16 @@ void Generator::GenerateFile(const GeneratorOptions& options, options.import_style == GeneratorOptions::kImportEs6)) { if (options.import_style == GeneratorOptions::kImportEs6) { printer->Print("import * as jspb from 'google-protobuf';\n"); + printer->Print("import * as goog from 'closure-library/closure/goog';\n\n"); } else { printer->Print("var jspb = require('google-protobuf');\n"); + printer->Print("var goog = jspb;\n"); } - printer->Print("var goog = jspb;\n"); // Do not use global scope in strict mode or with ES6 - if (options.import_style == GeneratorOptions::kImportCommonJsStrict || - options.import_style == GeneratorOptions::kImportEs6) { + if (options.import_style == GeneratorOptions::kImportCommonJsStrict) { printer->Print("var proto = {};\n\n"); - } else { + } else if (options.import_style != GeneratorOptions::kImportEs6) { // To get the global object we call a function with .call(null), this will // set "this" inside the function to the global object. This does not work // if we are running in strict mode ("use strict"), so we fallback to the From 1d464bf7823f1b1b1f68e999b012851ac3a25917 Mon Sep 17 00:00:00 2001 From: Jacob Fugal Date: Fri, 22 Aug 2025 13:54:29 -0600 Subject: [PATCH 12/12] audit and update message name generation * replace most uses of GetQualifiedMessagePath with either LocalMessageRef (when dealing with a top-level message for the file) or SubmessageTypeRef (when dealing with a message field) * similar for GetQualifiedEnumPath, but MaybeCrossFileEnumPath as the analogue for SubmessageTypeRef * update uses of LocalMessageRef for message fields to SubmessageTypeRef * update most uses of MaybeCrossFileMessageRef to SubmessageTypeRef --- example/test.js | 910 +++++++++++++++++++------------------- example/test2.js | 52 +-- generator/js_generator.cc | 109 +++-- 3 files changed, 534 insertions(+), 537 deletions(-) diff --git a/example/test.js b/example/test.js index e04a6b5d..eb67d79b 100644 --- a/example/test.js +++ b/example/test.js @@ -32,7 +32,7 @@ export class Empty extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Empty} + * @return {!Empty} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -44,9 +44,9 @@ export class Empty extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.Empty} msg The message object to deserialize into. + * @param {!Empty} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Empty} + * @return {!Empty} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -78,7 +78,7 @@ export class Empty extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Empty} message + * @param {!Empty} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -121,7 +121,7 @@ Empty.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Empty} msg The msg instance to transform. + * @param {!Empty} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -154,16 +154,16 @@ export class EnumContainer extends jspb.Message { }; /** * optional OuterEnum outer_enum = 1; - * @return {!proto.jspb.test.OuterEnum} + * @return {!OuterEnum} */ getOuterEnum() { - return /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getFieldWithDefault(this, 1, 1)); + return /** @type {!OuterEnum} */ (jspb.Message.getFieldWithDefault(this, 1, 1)); }; /** - * @param {!proto.jspb.test.OuterEnum} value - * @return {!proto.jspb.test.EnumContainer} returns this + * @param {!OuterEnum} value + * @return {!EnumContainer} returns this */ setOuterEnum(value) { return jspb.Message.setField(this, 1, value); @@ -172,7 +172,7 @@ export class EnumContainer extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.EnumContainer} returns this + * @return {!EnumContainer} returns this */ clearOuterEnum() { return jspb.Message.setField(this, 1, undefined); @@ -191,7 +191,7 @@ export class EnumContainer extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.EnumContainer} + * @return {!EnumContainer} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -203,9 +203,9 @@ export class EnumContainer extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.EnumContainer} msg The message object to deserialize into. + * @param {!EnumContainer} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.EnumContainer} + * @return {!EnumContainer} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -215,7 +215,7 @@ export class EnumContainer extends jspb.Message { var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {!proto.jspb.test.OuterEnum} */ (reader.readEnum()); + var value = /** @type {!OuterEnum} */ (reader.readEnum()); msg.setOuterEnum(value); break; default: @@ -241,13 +241,13 @@ export class EnumContainer extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.EnumContainer} message + * @param {!EnumContainer} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ static serializeBinaryToWriter(message, writer) { var f = undefined; - f = /** @type {!proto.jspb.test.OuterEnum} */ (jspb.Message.getField(message, 1)); + f = /** @type {!OuterEnum} */ (jspb.Message.getField(message, 1)); if (f != null) { writer.writeEnum( 1, @@ -291,7 +291,7 @@ EnumContainer.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.EnumContainer} msg The msg instance to transform. + * @param {!EnumContainer} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -333,7 +333,7 @@ export class Simple1 extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.Simple1} returns this + * @return {!Simple1} returns this */ setAString(value) { return jspb.Message.setField(this, 1, value); @@ -342,7 +342,7 @@ export class Simple1 extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.Simple1} returns this + * @return {!Simple1} returns this */ clearAString() { return jspb.Message.setField(this, 1, undefined); @@ -369,7 +369,7 @@ export class Simple1 extends jspb.Message { /** * @param {!Array} value - * @return {!proto.jspb.test.Simple1} returns this + * @return {!Simple1} returns this */ setARepeatedStringList(value) { return jspb.Message.setField(this, 2, value || []); @@ -379,7 +379,7 @@ export class Simple1 extends jspb.Message { /** * @param {string} value * @param {number=} opt_index - * @return {!proto.jspb.test.Simple1} returns this + * @return {!Simple1} returns this */ addARepeatedString(value, opt_index) { return jspb.Message.addToRepeatedField(this, 2, value, opt_index); @@ -388,7 +388,7 @@ export class Simple1 extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.Simple1} returns this + * @return {!Simple1} returns this */ clearARepeatedStringList() { return this.setARepeatedStringList([]); @@ -406,7 +406,7 @@ export class Simple1 extends jspb.Message { /** * @param {boolean} value - * @return {!proto.jspb.test.Simple1} returns this + * @return {!Simple1} returns this */ setABoolean(value) { return jspb.Message.setField(this, 3, value); @@ -415,7 +415,7 @@ export class Simple1 extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.Simple1} returns this + * @return {!Simple1} returns this */ clearABoolean() { return jspb.Message.setField(this, 3, undefined); @@ -434,7 +434,7 @@ export class Simple1 extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Simple1} + * @return {!Simple1} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -446,9 +446,9 @@ export class Simple1 extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.Simple1} msg The message object to deserialize into. + * @param {!Simple1} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Simple1} + * @return {!Simple1} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -492,7 +492,7 @@ export class Simple1 extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Simple1} message + * @param {!Simple1} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -563,7 +563,7 @@ Simple1.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Simple1} msg The msg instance to transform. + * @param {!Simple1} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -607,7 +607,7 @@ export class Simple2 extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.Simple2} returns this + * @return {!Simple2} returns this */ setAString(value) { return jspb.Message.setField(this, 1, value); @@ -616,7 +616,7 @@ export class Simple2 extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.Simple2} returns this + * @return {!Simple2} returns this */ clearAString() { return jspb.Message.setField(this, 1, undefined); @@ -643,7 +643,7 @@ export class Simple2 extends jspb.Message { /** * @param {!Array} value - * @return {!proto.jspb.test.Simple2} returns this + * @return {!Simple2} returns this */ setARepeatedStringList(value) { return jspb.Message.setField(this, 2, value || []); @@ -653,7 +653,7 @@ export class Simple2 extends jspb.Message { /** * @param {string} value * @param {number=} opt_index - * @return {!proto.jspb.test.Simple2} returns this + * @return {!Simple2} returns this */ addARepeatedString(value, opt_index) { return jspb.Message.addToRepeatedField(this, 2, value, opt_index); @@ -662,7 +662,7 @@ export class Simple2 extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.Simple2} returns this + * @return {!Simple2} returns this */ clearARepeatedStringList() { return this.setARepeatedStringList([]); @@ -672,7 +672,7 @@ export class Simple2 extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Simple2} + * @return {!Simple2} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -684,9 +684,9 @@ export class Simple2 extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.Simple2} msg The message object to deserialize into. + * @param {!Simple2} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Simple2} + * @return {!Simple2} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -726,7 +726,7 @@ export class Simple2 extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Simple2} message + * @param {!Simple2} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -790,7 +790,7 @@ Simple2.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Simple2} msg The msg instance to transform. + * @param {!Simple2} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -833,7 +833,7 @@ export class SpecialCases extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.SpecialCases} returns this + * @return {!SpecialCases} returns this */ setNormal(value) { return jspb.Message.setField(this, 1, value); @@ -842,7 +842,7 @@ export class SpecialCases extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.SpecialCases} returns this + * @return {!SpecialCases} returns this */ clearNormal() { return jspb.Message.setField(this, 1, undefined); @@ -869,7 +869,7 @@ export class SpecialCases extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.SpecialCases} returns this + * @return {!SpecialCases} returns this */ setDefault(value) { return jspb.Message.setField(this, 2, value); @@ -878,7 +878,7 @@ export class SpecialCases extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.SpecialCases} returns this + * @return {!SpecialCases} returns this */ clearDefault() { return jspb.Message.setField(this, 2, undefined); @@ -905,7 +905,7 @@ export class SpecialCases extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.SpecialCases} returns this + * @return {!SpecialCases} returns this */ setFunction(value) { return jspb.Message.setField(this, 3, value); @@ -914,7 +914,7 @@ export class SpecialCases extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.SpecialCases} returns this + * @return {!SpecialCases} returns this */ clearFunction() { return jspb.Message.setField(this, 3, undefined); @@ -941,7 +941,7 @@ export class SpecialCases extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.SpecialCases} returns this + * @return {!SpecialCases} returns this */ setVar(value) { return jspb.Message.setField(this, 4, value); @@ -950,7 +950,7 @@ export class SpecialCases extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.SpecialCases} returns this + * @return {!SpecialCases} returns this */ clearVar() { return jspb.Message.setField(this, 4, undefined); @@ -969,7 +969,7 @@ export class SpecialCases extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.SpecialCases} + * @return {!SpecialCases} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -981,9 +981,9 @@ export class SpecialCases extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.SpecialCases} msg The message object to deserialize into. + * @param {!SpecialCases} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.SpecialCases} + * @return {!SpecialCases} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -1031,7 +1031,7 @@ export class SpecialCases extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.SpecialCases} message + * @param {!SpecialCases} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -1102,7 +1102,7 @@ SpecialCases.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.SpecialCases} msg The msg instance to transform. + * @param {!SpecialCases} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -1147,7 +1147,7 @@ export class OptionalFields extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.OptionalFields} returns this + * @return {!OptionalFields} returns this */ setAString(value) { return jspb.Message.setField(this, 1, value); @@ -1156,7 +1156,7 @@ export class OptionalFields extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.OptionalFields} returns this + * @return {!OptionalFields} returns this */ clearAString() { return jspb.Message.setField(this, 1, undefined); @@ -1183,7 +1183,7 @@ export class OptionalFields extends jspb.Message { /** * @param {boolean} value - * @return {!proto.jspb.test.OptionalFields} returns this + * @return {!OptionalFields} returns this */ setABool(value) { return jspb.Message.setField(this, 2, value); @@ -1192,7 +1192,7 @@ export class OptionalFields extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.OptionalFields} returns this + * @return {!OptionalFields} returns this */ clearABool() { return jspb.Message.setField(this, 2, undefined); @@ -1210,17 +1210,17 @@ export class OptionalFields extends jspb.Message { /** * optional Nested a_nested_message = 3; - * @return {?proto.jspb.test.OptionalFields.Nested} + * @return {?OptionalFields.Nested} */ getANestedMessage() { - return /** @type{?proto.jspb.test.OptionalFields.Nested} */ ( + return /** @type{?OptionalFields.Nested} */ ( jspb.Message.getWrapperField(this, OptionalFields.Nested, 3)); }; /** - * @param {?proto.jspb.test.OptionalFields.Nested|undefined} value - * @return {!proto.jspb.test.OptionalFields} returns this + * @param {?OptionalFields.Nested|undefined} value + * @return {!OptionalFields} returns this */ setANestedMessage(value) { return jspb.Message.setWrapperField(this, 3, value); @@ -1229,7 +1229,7 @@ export class OptionalFields extends jspb.Message { /** * Clears the message field making it undefined. - * @return {!proto.jspb.test.OptionalFields} returns this + * @return {!OptionalFields} returns this */ clearANestedMessage() { return this.setANestedMessage(undefined); @@ -1247,17 +1247,17 @@ export class OptionalFields extends jspb.Message { /** * repeated Nested a_repeated_message = 4; - * @return {!Array} + * @return {!Array} */ getARepeatedMessageList() { - return /** @type{!Array} */ ( + return /** @type{!Array} */ ( jspb.Message.getRepeatedWrapperField(this, OptionalFields.Nested, 4)); }; /** - * @param {!Array} value - * @return {!proto.jspb.test.OptionalFields} returns this + * @param {!Array} value + * @return {!OptionalFields} returns this */ setARepeatedMessageList(value) { return jspb.Message.setRepeatedWrapperField(this, 4, value); @@ -1265,9 +1265,9 @@ export class OptionalFields extends jspb.Message { /** - * @param {!proto.jspb.test.OptionalFields.Nested} opt_value + * @param {!OptionalFields.Nested} opt_value * @param {number=} opt_index - * @return {!proto.jspb.test.OptionalFields.Nested} + * @return {!OptionalFields.Nested} */ addARepeatedMessage(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 4, opt_value, OptionalFields.Nested, opt_index); @@ -1276,7 +1276,7 @@ export class OptionalFields extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.OptionalFields} returns this + * @return {!OptionalFields} returns this */ clearARepeatedMessageList() { return this.setARepeatedMessageList([]); @@ -1294,7 +1294,7 @@ export class OptionalFields extends jspb.Message { /** * @param {!Array} value - * @return {!proto.jspb.test.OptionalFields} returns this + * @return {!OptionalFields} returns this */ setARepeatedStringList(value) { return jspb.Message.setField(this, 5, value || []); @@ -1304,7 +1304,7 @@ export class OptionalFields extends jspb.Message { /** * @param {string} value * @param {number=} opt_index - * @return {!proto.jspb.test.OptionalFields} returns this + * @return {!OptionalFields} returns this */ addARepeatedString(value, opt_index) { return jspb.Message.addToRepeatedField(this, 5, value, opt_index); @@ -1313,7 +1313,7 @@ export class OptionalFields extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.OptionalFields} returns this + * @return {!OptionalFields} returns this */ clearARepeatedStringList() { return this.setARepeatedStringList([]); @@ -1323,7 +1323,7 @@ export class OptionalFields extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.OptionalFields} + * @return {!OptionalFields} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -1335,9 +1335,9 @@ export class OptionalFields extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.OptionalFields} msg The message object to deserialize into. + * @param {!OptionalFields} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.OptionalFields} + * @return {!OptionalFields} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -1391,7 +1391,7 @@ export class OptionalFields extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.OptionalFields} message + * @param {!OptionalFields} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -1478,7 +1478,7 @@ OptionalFields.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.OptionalFields} msg The msg instance to transform. + * @param {!OptionalFields} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -1525,7 +1525,7 @@ OptionalFields.Nested = class extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.OptionalFields.Nested} returns this + * @return {!OptionalFields.Nested} returns this */ setAnInt(value) { return jspb.Message.setField(this, 1, value); @@ -1534,7 +1534,7 @@ OptionalFields.Nested = class extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.OptionalFields.Nested} returns this + * @return {!OptionalFields.Nested} returns this */ clearAnInt() { return jspb.Message.setField(this, 1, undefined); @@ -1553,7 +1553,7 @@ OptionalFields.Nested = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.OptionalFields.Nested} + * @return {!OptionalFields.Nested} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -1565,9 +1565,9 @@ OptionalFields.Nested = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.OptionalFields.Nested} msg The message object to deserialize into. + * @param {!OptionalFields.Nested} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.OptionalFields.Nested} + * @return {!OptionalFields.Nested} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -1603,7 +1603,7 @@ OptionalFields.Nested = class extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.OptionalFields.Nested} message + * @param {!OptionalFields.Nested} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -1653,7 +1653,7 @@ OptionalFields.Nested.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.OptionalFields.Nested} msg The msg instance to transform. + * @param {!OptionalFields.Nested} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -1695,7 +1695,7 @@ export class HasExtensions extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.HasExtensions} returns this + * @return {!HasExtensions} returns this */ setStr1(value) { return jspb.Message.setField(this, 1, value); @@ -1704,7 +1704,7 @@ export class HasExtensions extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.HasExtensions} returns this + * @return {!HasExtensions} returns this */ clearStr1() { return jspb.Message.setField(this, 1, undefined); @@ -1731,7 +1731,7 @@ export class HasExtensions extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.HasExtensions} returns this + * @return {!HasExtensions} returns this */ setStr2(value) { return jspb.Message.setField(this, 2, value); @@ -1740,7 +1740,7 @@ export class HasExtensions extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.HasExtensions} returns this + * @return {!HasExtensions} returns this */ clearStr2() { return jspb.Message.setField(this, 2, undefined); @@ -1767,7 +1767,7 @@ export class HasExtensions extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.HasExtensions} returns this + * @return {!HasExtensions} returns this */ setStr3(value) { return jspb.Message.setField(this, 3, value); @@ -1776,7 +1776,7 @@ export class HasExtensions extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.HasExtensions} returns this + * @return {!HasExtensions} returns this */ clearStr3() { return jspb.Message.setField(this, 3, undefined); @@ -1795,7 +1795,7 @@ export class HasExtensions extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.HasExtensions} + * @return {!HasExtensions} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -1807,9 +1807,9 @@ export class HasExtensions extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.HasExtensions} msg The message object to deserialize into. + * @param {!HasExtensions} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.HasExtensions} + * @return {!HasExtensions} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -1856,7 +1856,7 @@ export class HasExtensions extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.HasExtensions} message + * @param {!HasExtensions} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -1952,7 +1952,7 @@ HasExtensions.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.HasExtensions} msg The msg instance to transform. + * @param {!HasExtensions} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -1999,7 +1999,7 @@ export class Complex extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.Complex} returns this + * @return {!Complex} returns this */ setAString(value) { return jspb.Message.setField(this, 1, value); @@ -2008,7 +2008,7 @@ export class Complex extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.Complex} returns this + * @return {!Complex} returns this */ clearAString() { return jspb.Message.setField(this, 1, undefined); @@ -2035,7 +2035,7 @@ export class Complex extends jspb.Message { /** * @param {boolean} value - * @return {!proto.jspb.test.Complex} returns this + * @return {!Complex} returns this */ setAnOutOfOrderBool(value) { return jspb.Message.setField(this, 9, value); @@ -2044,7 +2044,7 @@ export class Complex extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.Complex} returns this + * @return {!Complex} returns this */ clearAnOutOfOrderBool() { return jspb.Message.setField(this, 9, undefined); @@ -2062,17 +2062,17 @@ export class Complex extends jspb.Message { /** * optional Nested a_nested_message = 4; - * @return {?proto.jspb.test.Complex.Nested} + * @return {?Complex.Nested} */ getANestedMessage() { - return /** @type{?proto.jspb.test.Complex.Nested} */ ( + return /** @type{?Complex.Nested} */ ( jspb.Message.getWrapperField(this, Complex.Nested, 4)); }; /** - * @param {?proto.jspb.test.Complex.Nested|undefined} value - * @return {!proto.jspb.test.Complex} returns this + * @param {?Complex.Nested|undefined} value + * @return {!Complex} returns this */ setANestedMessage(value) { return jspb.Message.setWrapperField(this, 4, value); @@ -2081,7 +2081,7 @@ export class Complex extends jspb.Message { /** * Clears the message field making it undefined. - * @return {!proto.jspb.test.Complex} returns this + * @return {!Complex} returns this */ clearANestedMessage() { return this.setANestedMessage(undefined); @@ -2099,17 +2099,17 @@ export class Complex extends jspb.Message { /** * repeated Nested a_repeated_message = 5; - * @return {!Array} + * @return {!Array} */ getARepeatedMessageList() { - return /** @type{!Array} */ ( + return /** @type{!Array} */ ( jspb.Message.getRepeatedWrapperField(this, Complex.Nested, 5)); }; /** - * @param {!Array} value - * @return {!proto.jspb.test.Complex} returns this + * @param {!Array} value + * @return {!Complex} returns this */ setARepeatedMessageList(value) { return jspb.Message.setRepeatedWrapperField(this, 5, value); @@ -2117,9 +2117,9 @@ export class Complex extends jspb.Message { /** - * @param {!proto.jspb.test.Complex.Nested} opt_value + * @param {!Complex.Nested} opt_value * @param {number=} opt_index - * @return {!proto.jspb.test.Complex.Nested} + * @return {!Complex.Nested} */ addARepeatedMessage(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, Complex.Nested, opt_index); @@ -2128,7 +2128,7 @@ export class Complex extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.Complex} returns this + * @return {!Complex} returns this */ clearARepeatedMessageList() { return this.setARepeatedMessageList([]); @@ -2146,7 +2146,7 @@ export class Complex extends jspb.Message { /** * @param {!Array} value - * @return {!proto.jspb.test.Complex} returns this + * @return {!Complex} returns this */ setARepeatedStringList(value) { return jspb.Message.setField(this, 7, value || []); @@ -2156,7 +2156,7 @@ export class Complex extends jspb.Message { /** * @param {string} value * @param {number=} opt_index - * @return {!proto.jspb.test.Complex} returns this + * @return {!Complex} returns this */ addARepeatedString(value, opt_index) { return jspb.Message.addToRepeatedField(this, 7, value, opt_index); @@ -2165,7 +2165,7 @@ export class Complex extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.Complex} returns this + * @return {!Complex} returns this */ clearARepeatedStringList() { return this.setARepeatedStringList([]); @@ -2183,7 +2183,7 @@ export class Complex extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.Complex} returns this + * @return {!Complex} returns this */ setAFloatingPointField(value) { return jspb.Message.setField(this, 10, value); @@ -2192,7 +2192,7 @@ export class Complex extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.Complex} returns this + * @return {!Complex} returns this */ clearAFloatingPointField() { return jspb.Message.setField(this, 10, undefined); @@ -2211,7 +2211,7 @@ export class Complex extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Complex} + * @return {!Complex} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -2223,9 +2223,9 @@ export class Complex extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.Complex} msg The message object to deserialize into. + * @param {!Complex} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Complex} + * @return {!Complex} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -2283,7 +2283,7 @@ export class Complex extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Complex} message + * @param {!Complex} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -2377,7 +2377,7 @@ Complex.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Complex} msg The msg instance to transform. + * @param {!Complex} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -2425,7 +2425,7 @@ Complex.Nested = class extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.Complex.Nested} returns this + * @return {!Complex.Nested} returns this */ setAnInt(value) { return jspb.Message.setField(this, 2, value); @@ -2434,7 +2434,7 @@ Complex.Nested = class extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.Complex.Nested} returns this + * @return {!Complex.Nested} returns this */ clearAnInt() { return jspb.Message.setField(this, 2, undefined); @@ -2453,7 +2453,7 @@ Complex.Nested = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Complex.Nested} + * @return {!Complex.Nested} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -2465,9 +2465,9 @@ Complex.Nested = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.Complex.Nested} msg The message object to deserialize into. + * @param {!Complex.Nested} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Complex.Nested} + * @return {!Complex.Nested} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -2503,7 +2503,7 @@ Complex.Nested = class extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Complex.Nested} message + * @param {!Complex.Nested} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -2553,7 +2553,7 @@ Complex.Nested.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Complex.Nested} msg The msg instance to transform. + * @param {!Complex.Nested} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -2587,7 +2587,7 @@ export class OuterMessage extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.OuterMessage} + * @return {!OuterMessage} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -2599,9 +2599,9 @@ export class OuterMessage extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.OuterMessage} msg The message object to deserialize into. + * @param {!OuterMessage} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.OuterMessage} + * @return {!OuterMessage} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -2633,7 +2633,7 @@ export class OuterMessage extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.OuterMessage} message + * @param {!OuterMessage} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -2676,7 +2676,7 @@ OuterMessage.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.OuterMessage} msg The msg instance to transform. + * @param {!OuterMessage} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -2718,7 +2718,7 @@ OuterMessage.Complex = class extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.OuterMessage.Complex} returns this + * @return {!OuterMessage.Complex} returns this */ setInnerComplexField(value) { return jspb.Message.setField(this, 1, value); @@ -2727,7 +2727,7 @@ OuterMessage.Complex = class extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.OuterMessage.Complex} returns this + * @return {!OuterMessage.Complex} returns this */ clearInnerComplexField() { return jspb.Message.setField(this, 1, undefined); @@ -2746,7 +2746,7 @@ OuterMessage.Complex = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.OuterMessage.Complex} + * @return {!OuterMessage.Complex} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -2758,9 +2758,9 @@ OuterMessage.Complex = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.OuterMessage.Complex} msg The message object to deserialize into. + * @param {!OuterMessage.Complex} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.OuterMessage.Complex} + * @return {!OuterMessage.Complex} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -2796,7 +2796,7 @@ OuterMessage.Complex = class extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.OuterMessage.Complex} message + * @param {!OuterMessage.Complex} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -2846,7 +2846,7 @@ OuterMessage.Complex.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.OuterMessage.Complex} msg The msg instance to transform. + * @param {!OuterMessage.Complex} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -2888,7 +2888,7 @@ export class MineField extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.MineField} returns this + * @return {!MineField} returns this */ setCookie(value) { return jspb.Message.setField(this, 1, value); @@ -2897,7 +2897,7 @@ export class MineField extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.MineField} returns this + * @return {!MineField} returns this */ clearCookie() { return jspb.Message.setField(this, 1, undefined); @@ -2916,7 +2916,7 @@ export class MineField extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.MineField} + * @return {!MineField} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -2928,9 +2928,9 @@ export class MineField extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.MineField} msg The message object to deserialize into. + * @param {!MineField} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.MineField} + * @return {!MineField} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -2966,7 +2966,7 @@ export class MineField extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.MineField} message + * @param {!MineField} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -3016,7 +3016,7 @@ MineField.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.MineField} msg The msg instance to transform. + * @param {!MineField} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -3058,7 +3058,7 @@ export class IsExtension extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.IsExtension} returns this + * @return {!IsExtension} returns this */ setExt1(value) { return jspb.Message.setField(this, 1, value); @@ -3067,7 +3067,7 @@ export class IsExtension extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.IsExtension} returns this + * @return {!IsExtension} returns this */ clearExt1() { return jspb.Message.setField(this, 1, undefined); @@ -3086,7 +3086,7 @@ export class IsExtension extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.IsExtension} + * @return {!IsExtension} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -3098,9 +3098,9 @@ export class IsExtension extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.IsExtension} msg The message object to deserialize into. + * @param {!IsExtension} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.IsExtension} + * @return {!IsExtension} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -3136,7 +3136,7 @@ export class IsExtension extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.IsExtension} message + * @param {!IsExtension} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -3165,7 +3165,7 @@ if (goog.DEBUG && !COMPILED) { /** * A tuple of {field number, class constructor} for the extension * field named `extField`. - * @type {!jspb.ExtensionFieldInfo} + * @type {!jspb.ExtensionFieldInfo} */ IsExtension.extField = new jspb.ExtensionFieldInfo( 100, @@ -3199,7 +3199,7 @@ IsExtension.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.IsExtension} msg The msg instance to transform. + * @param {!IsExtension} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -3245,7 +3245,7 @@ export class IndirectExtension extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.IndirectExtension} + * @return {!IndirectExtension} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -3257,9 +3257,9 @@ export class IndirectExtension extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.IndirectExtension} msg The message object to deserialize into. + * @param {!IndirectExtension} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.IndirectExtension} + * @return {!IndirectExtension} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -3291,7 +3291,7 @@ export class IndirectExtension extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.IndirectExtension} message + * @param {!IndirectExtension} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -3313,7 +3313,7 @@ if (goog.DEBUG && !COMPILED) { /** * A tuple of {field number, class constructor} for the extension * field named `simple`. - * @type {!jspb.ExtensionFieldInfo} + * @type {!jspb.ExtensionFieldInfo} */ IndirectExtension.simple = new jspb.ExtensionFieldInfo( 101, @@ -3352,7 +3352,7 @@ IndirectExtension.repeatedStrList = new jspb.ExtensionFieldInfo( /** * A tuple of {field number, class constructor} for the extension * field named `repeatedSimpleList`. - * @type {!jspb.ExtensionFieldInfo>} + * @type {!jspb.ExtensionFieldInfo>} */ IndirectExtension.repeatedSimpleList = new jspb.ExtensionFieldInfo( 104, @@ -3386,7 +3386,7 @@ IndirectExtension.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.IndirectExtension} msg The msg instance to transform. + * @param {!IndirectExtension} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -3476,7 +3476,7 @@ export class DefaultValues extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.DefaultValues} returns this + * @return {!DefaultValues} returns this */ setStringField(value) { return jspb.Message.setField(this, 1, value); @@ -3485,7 +3485,7 @@ export class DefaultValues extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.DefaultValues} returns this + * @return {!DefaultValues} returns this */ clearStringField() { return jspb.Message.setField(this, 1, undefined); @@ -3512,7 +3512,7 @@ export class DefaultValues extends jspb.Message { /** * @param {boolean} value - * @return {!proto.jspb.test.DefaultValues} returns this + * @return {!DefaultValues} returns this */ setBoolField(value) { return jspb.Message.setField(this, 2, value); @@ -3521,7 +3521,7 @@ export class DefaultValues extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.DefaultValues} returns this + * @return {!DefaultValues} returns this */ clearBoolField() { return jspb.Message.setField(this, 2, undefined); @@ -3548,7 +3548,7 @@ export class DefaultValues extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.DefaultValues} returns this + * @return {!DefaultValues} returns this */ setIntField(value) { return jspb.Message.setField(this, 3, value); @@ -3557,7 +3557,7 @@ export class DefaultValues extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.DefaultValues} returns this + * @return {!DefaultValues} returns this */ clearIntField() { return jspb.Message.setField(this, 3, undefined); @@ -3575,16 +3575,16 @@ export class DefaultValues extends jspb.Message { /** * optional Enum enum_field = 4; - * @return {!proto.jspb.test.DefaultValues.Enum} + * @return {!DefaultValues.Enum} */ getEnumField() { - return /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getFieldWithDefault(this, 4, 13)); + return /** @type {!DefaultValues.Enum} */ (jspb.Message.getFieldWithDefault(this, 4, 13)); }; /** - * @param {!proto.jspb.test.DefaultValues.Enum} value - * @return {!proto.jspb.test.DefaultValues} returns this + * @param {!DefaultValues.Enum} value + * @return {!DefaultValues} returns this */ setEnumField(value) { return jspb.Message.setField(this, 4, value); @@ -3593,7 +3593,7 @@ export class DefaultValues extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.DefaultValues} returns this + * @return {!DefaultValues} returns this */ clearEnumField() { return jspb.Message.setField(this, 4, undefined); @@ -3620,7 +3620,7 @@ export class DefaultValues extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.DefaultValues} returns this + * @return {!DefaultValues} returns this */ setEmptyField(value) { return jspb.Message.setField(this, 6, value); @@ -3629,7 +3629,7 @@ export class DefaultValues extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.DefaultValues} returns this + * @return {!DefaultValues} returns this */ clearEmptyField() { return jspb.Message.setField(this, 6, undefined); @@ -3680,7 +3680,7 @@ export class DefaultValues extends jspb.Message { /** * @param {!(string|Uint8Array)} value - * @return {!proto.jspb.test.DefaultValues} returns this + * @return {!DefaultValues} returns this */ setBytesField(value) { return jspb.Message.setField(this, 8, value); @@ -3689,7 +3689,7 @@ export class DefaultValues extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.DefaultValues} returns this + * @return {!DefaultValues} returns this */ clearBytesField() { return jspb.Message.setField(this, 8, undefined); @@ -3708,7 +3708,7 @@ export class DefaultValues extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.DefaultValues} + * @return {!DefaultValues} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -3720,9 +3720,9 @@ export class DefaultValues extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.DefaultValues} msg The message object to deserialize into. + * @param {!DefaultValues} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.DefaultValues} + * @return {!DefaultValues} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -3744,7 +3744,7 @@ export class DefaultValues extends jspb.Message { msg.setIntField(value); break; case 4: - var value = /** @type {!proto.jspb.test.DefaultValues.Enum} */ (reader.readEnum()); + var value = /** @type {!DefaultValues.Enum} */ (reader.readEnum()); msg.setEnumField(value); break; case 6: @@ -3778,7 +3778,7 @@ export class DefaultValues extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.DefaultValues} message + * @param {!DefaultValues} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -3805,7 +3805,7 @@ export class DefaultValues extends jspb.Message { f ); } - f = /** @type {!proto.jspb.test.DefaultValues.Enum} */ (jspb.Message.getField(message, 4)); + f = /** @type {!DefaultValues.Enum} */ (jspb.Message.getField(message, 4)); if (f != null) { writer.writeEnum( 4, @@ -3871,7 +3871,7 @@ DefaultValues.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.DefaultValues} msg The msg instance to transform. + * @param {!DefaultValues} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -3918,7 +3918,7 @@ export class FloatingPointFields extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ setOptionalFloatField(value) { return jspb.Message.setField(this, 1, value); @@ -3927,7 +3927,7 @@ export class FloatingPointFields extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ clearOptionalFloatField() { return jspb.Message.setField(this, 1, undefined); @@ -3954,7 +3954,7 @@ export class FloatingPointFields extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ setRequiredFloatField(value) { return jspb.Message.setField(this, 2, value); @@ -3963,7 +3963,7 @@ export class FloatingPointFields extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ clearRequiredFloatField() { return jspb.Message.setField(this, 2, undefined); @@ -3990,7 +3990,7 @@ export class FloatingPointFields extends jspb.Message { /** * @param {!Array} value - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ setRepeatedFloatFieldList(value) { return jspb.Message.setField(this, 3, value || []); @@ -4000,7 +4000,7 @@ export class FloatingPointFields extends jspb.Message { /** * @param {number} value * @param {number=} opt_index - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ addRepeatedFloatField(value, opt_index) { return jspb.Message.addToRepeatedField(this, 3, value, opt_index); @@ -4009,7 +4009,7 @@ export class FloatingPointFields extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ clearRepeatedFloatFieldList() { return this.setRepeatedFloatFieldList([]); @@ -4027,7 +4027,7 @@ export class FloatingPointFields extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ setDefaultFloatField(value) { return jspb.Message.setField(this, 4, value); @@ -4036,7 +4036,7 @@ export class FloatingPointFields extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ clearDefaultFloatField() { return jspb.Message.setField(this, 4, undefined); @@ -4063,7 +4063,7 @@ export class FloatingPointFields extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ setOptionalDoubleField(value) { return jspb.Message.setField(this, 5, value); @@ -4072,7 +4072,7 @@ export class FloatingPointFields extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ clearOptionalDoubleField() { return jspb.Message.setField(this, 5, undefined); @@ -4099,7 +4099,7 @@ export class FloatingPointFields extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ setRequiredDoubleField(value) { return jspb.Message.setField(this, 6, value); @@ -4108,7 +4108,7 @@ export class FloatingPointFields extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ clearRequiredDoubleField() { return jspb.Message.setField(this, 6, undefined); @@ -4135,7 +4135,7 @@ export class FloatingPointFields extends jspb.Message { /** * @param {!Array} value - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ setRepeatedDoubleFieldList(value) { return jspb.Message.setField(this, 7, value || []); @@ -4145,7 +4145,7 @@ export class FloatingPointFields extends jspb.Message { /** * @param {number} value * @param {number=} opt_index - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ addRepeatedDoubleField(value, opt_index) { return jspb.Message.addToRepeatedField(this, 7, value, opt_index); @@ -4154,7 +4154,7 @@ export class FloatingPointFields extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ clearRepeatedDoubleFieldList() { return this.setRepeatedDoubleFieldList([]); @@ -4172,7 +4172,7 @@ export class FloatingPointFields extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ setDefaultDoubleField(value) { return jspb.Message.setField(this, 8, value); @@ -4181,7 +4181,7 @@ export class FloatingPointFields extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.FloatingPointFields} returns this + * @return {!FloatingPointFields} returns this */ clearDefaultDoubleField() { return jspb.Message.setField(this, 8, undefined); @@ -4200,7 +4200,7 @@ export class FloatingPointFields extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.FloatingPointFields} + * @return {!FloatingPointFields} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -4212,9 +4212,9 @@ export class FloatingPointFields extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.FloatingPointFields} msg The message object to deserialize into. + * @param {!FloatingPointFields} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.FloatingPointFields} + * @return {!FloatingPointFields} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -4282,7 +4282,7 @@ export class FloatingPointFields extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.FloatingPointFields} message + * @param {!FloatingPointFields} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -4388,7 +4388,7 @@ FloatingPointFields.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.FloatingPointFields} msg The msg instance to transform. + * @param {!FloatingPointFields} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -4437,7 +4437,7 @@ export class BooleanFields extends jspb.Message { /** * @param {boolean} value - * @return {!proto.jspb.test.BooleanFields} returns this + * @return {!BooleanFields} returns this */ setOptionalBooleanField(value) { return jspb.Message.setField(this, 1, value); @@ -4446,7 +4446,7 @@ export class BooleanFields extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.BooleanFields} returns this + * @return {!BooleanFields} returns this */ clearOptionalBooleanField() { return jspb.Message.setField(this, 1, undefined); @@ -4473,7 +4473,7 @@ export class BooleanFields extends jspb.Message { /** * @param {boolean} value - * @return {!proto.jspb.test.BooleanFields} returns this + * @return {!BooleanFields} returns this */ setRequiredBooleanField(value) { return jspb.Message.setField(this, 2, value); @@ -4482,7 +4482,7 @@ export class BooleanFields extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.BooleanFields} returns this + * @return {!BooleanFields} returns this */ clearRequiredBooleanField() { return jspb.Message.setField(this, 2, undefined); @@ -4509,7 +4509,7 @@ export class BooleanFields extends jspb.Message { /** * @param {!Array} value - * @return {!proto.jspb.test.BooleanFields} returns this + * @return {!BooleanFields} returns this */ setRepeatedBooleanFieldList(value) { return jspb.Message.setField(this, 3, value || []); @@ -4519,7 +4519,7 @@ export class BooleanFields extends jspb.Message { /** * @param {boolean} value * @param {number=} opt_index - * @return {!proto.jspb.test.BooleanFields} returns this + * @return {!BooleanFields} returns this */ addRepeatedBooleanField(value, opt_index) { return jspb.Message.addToRepeatedField(this, 3, value, opt_index); @@ -4528,7 +4528,7 @@ export class BooleanFields extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.BooleanFields} returns this + * @return {!BooleanFields} returns this */ clearRepeatedBooleanFieldList() { return this.setRepeatedBooleanFieldList([]); @@ -4546,7 +4546,7 @@ export class BooleanFields extends jspb.Message { /** * @param {boolean} value - * @return {!proto.jspb.test.BooleanFields} returns this + * @return {!BooleanFields} returns this */ setDefaultBooleanField(value) { return jspb.Message.setField(this, 4, value); @@ -4555,7 +4555,7 @@ export class BooleanFields extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.BooleanFields} returns this + * @return {!BooleanFields} returns this */ clearDefaultBooleanField() { return jspb.Message.setField(this, 4, undefined); @@ -4574,7 +4574,7 @@ export class BooleanFields extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.BooleanFields} + * @return {!BooleanFields} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -4586,9 +4586,9 @@ export class BooleanFields extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.BooleanFields} msg The message object to deserialize into. + * @param {!BooleanFields} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.BooleanFields} + * @return {!BooleanFields} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -4638,7 +4638,7 @@ export class BooleanFields extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.BooleanFields} message + * @param {!BooleanFields} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -4716,7 +4716,7 @@ BooleanFields.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.BooleanFields} msg The msg instance to transform. + * @param {!BooleanFields} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -4761,7 +4761,7 @@ export class TestClone extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.TestClone} returns this + * @return {!TestClone} returns this */ setStr(value) { return jspb.Message.setField(this, 1, value); @@ -4770,7 +4770,7 @@ export class TestClone extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestClone} returns this + * @return {!TestClone} returns this */ clearStr() { return jspb.Message.setField(this, 1, undefined); @@ -4788,17 +4788,17 @@ export class TestClone extends jspb.Message { /** * optional Simple1 simple1 = 3; - * @return {?proto.jspb.test.Simple1} + * @return {?Simple1} */ getSimple1() { - return /** @type{?proto.jspb.test.Simple1} */ ( + return /** @type{?Simple1} */ ( jspb.Message.getWrapperField(this, Simple1, 3)); }; /** - * @param {?proto.jspb.test.Simple1|undefined} value - * @return {!proto.jspb.test.TestClone} returns this + * @param {?Simple1|undefined} value + * @return {!TestClone} returns this */ setSimple1(value) { return jspb.Message.setWrapperField(this, 3, value); @@ -4807,7 +4807,7 @@ export class TestClone extends jspb.Message { /** * Clears the message field making it undefined. - * @return {!proto.jspb.test.TestClone} returns this + * @return {!TestClone} returns this */ clearSimple1() { return this.setSimple1(undefined); @@ -4825,17 +4825,17 @@ export class TestClone extends jspb.Message { /** * repeated Simple1 simple2 = 5; - * @return {!Array} + * @return {!Array} */ getSimple2List() { - return /** @type{!Array} */ ( + return /** @type{!Array} */ ( jspb.Message.getRepeatedWrapperField(this, Simple1, 5)); }; /** - * @param {!Array} value - * @return {!proto.jspb.test.TestClone} returns this + * @param {!Array} value + * @return {!TestClone} returns this */ setSimple2List(value) { return jspb.Message.setRepeatedWrapperField(this, 5, value); @@ -4843,9 +4843,9 @@ export class TestClone extends jspb.Message { /** - * @param {!proto.jspb.test.Simple1} opt_value + * @param {!Simple1} opt_value * @param {number=} opt_index - * @return {!proto.jspb.test.Simple1} + * @return {!Simple1} */ addSimple2(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 5, opt_value, Simple1, opt_index); @@ -4854,7 +4854,7 @@ export class TestClone extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.TestClone} returns this + * @return {!TestClone} returns this */ clearSimple2List() { return this.setSimple2List([]); @@ -4896,7 +4896,7 @@ export class TestClone extends jspb.Message { /** * @param {!(string|Uint8Array)} value - * @return {!proto.jspb.test.TestClone} returns this + * @return {!TestClone} returns this */ setBytesField(value) { return jspb.Message.setField(this, 6, value); @@ -4905,7 +4905,7 @@ export class TestClone extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestClone} returns this + * @return {!TestClone} returns this */ clearBytesField() { return jspb.Message.setField(this, 6, undefined); @@ -4932,7 +4932,7 @@ export class TestClone extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.TestClone} returns this + * @return {!TestClone} returns this */ setUnused(value) { return jspb.Message.setField(this, 7, value); @@ -4941,7 +4941,7 @@ export class TestClone extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestClone} returns this + * @return {!TestClone} returns this */ clearUnused() { return jspb.Message.setField(this, 7, undefined); @@ -4960,7 +4960,7 @@ export class TestClone extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestClone} + * @return {!TestClone} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -4972,9 +4972,9 @@ export class TestClone extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestClone} msg The message object to deserialize into. + * @param {!TestClone} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestClone} + * @return {!TestClone} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -5031,7 +5031,7 @@ export class TestClone extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestClone} message + * @param {!TestClone} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -5150,7 +5150,7 @@ TestClone.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestClone} msg The msg instance to transform. + * @param {!TestClone} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -5200,7 +5200,7 @@ export class TestCloneExtension extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.TestCloneExtension} returns this + * @return {!TestCloneExtension} returns this */ setF(value) { return jspb.Message.setField(this, 1, value); @@ -5209,7 +5209,7 @@ export class TestCloneExtension extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestCloneExtension} returns this + * @return {!TestCloneExtension} returns this */ clearF() { return jspb.Message.setField(this, 1, undefined); @@ -5228,7 +5228,7 @@ export class TestCloneExtension extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestCloneExtension} + * @return {!TestCloneExtension} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -5240,9 +5240,9 @@ export class TestCloneExtension extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestCloneExtension} msg The message object to deserialize into. + * @param {!TestCloneExtension} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestCloneExtension} + * @return {!TestCloneExtension} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -5278,7 +5278,7 @@ export class TestCloneExtension extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestCloneExtension} message + * @param {!TestCloneExtension} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -5307,7 +5307,7 @@ if (goog.DEBUG && !COMPILED) { /** * A tuple of {field number, class constructor} for the extension * field named `lowExt`. - * @type {!jspb.ExtensionFieldInfo} + * @type {!jspb.ExtensionFieldInfo} */ TestCloneExtension.lowExt = new jspb.ExtensionFieldInfo( 11, @@ -5341,7 +5341,7 @@ TestCloneExtension.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestCloneExtension} msg The msg instance to transform. + * @param {!TestCloneExtension} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -5395,7 +5395,7 @@ export class CloneExtension extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.CloneExtension} returns this + * @return {!CloneExtension} returns this */ setExt(value) { return jspb.Message.setField(this, 2, value); @@ -5404,7 +5404,7 @@ export class CloneExtension extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.CloneExtension} returns this + * @return {!CloneExtension} returns this */ clearExt() { return jspb.Message.setField(this, 2, undefined); @@ -5423,7 +5423,7 @@ export class CloneExtension extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.CloneExtension} + * @return {!CloneExtension} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -5435,9 +5435,9 @@ export class CloneExtension extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.CloneExtension} msg The message object to deserialize into. + * @param {!CloneExtension} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.CloneExtension} + * @return {!CloneExtension} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -5473,7 +5473,7 @@ export class CloneExtension extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.CloneExtension} message + * @param {!CloneExtension} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -5502,7 +5502,7 @@ if (goog.DEBUG && !COMPILED) { /** * A tuple of {field number, class constructor} for the extension * field named `extField`. - * @type {!jspb.ExtensionFieldInfo} + * @type {!jspb.ExtensionFieldInfo} */ CloneExtension.extField = new jspb.ExtensionFieldInfo( 100, @@ -5536,7 +5536,7 @@ CloneExtension.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.CloneExtension} msg The msg instance to transform. + * @param {!CloneExtension} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -5581,17 +5581,17 @@ export class TestGroup extends jspb.Message { }; /** * repeated group RepeatedGroup = 1; - * @return {!Array} + * @return {!Array} */ getRepeatedGroupList() { - return /** @type{!Array} */ ( + return /** @type{!Array} */ ( jspb.Message.getRepeatedWrapperField(this, TestGroup.RepeatedGroup, 1)); }; /** - * @param {!Array} value - * @return {!proto.jspb.test.TestGroup} returns this + * @param {!Array} value + * @return {!TestGroup} returns this */ setRepeatedGroupList(value) { return jspb.Message.setRepeatedWrapperField(this, 1, value); @@ -5599,9 +5599,9 @@ export class TestGroup extends jspb.Message { /** - * @param {!proto.jspb.test.TestGroup.RepeatedGroup} opt_value + * @param {!TestGroup.RepeatedGroup} opt_value * @param {number=} opt_index - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + * @return {!TestGroup.RepeatedGroup} */ addRepeatedGroup(opt_value, opt_index) { return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, TestGroup.RepeatedGroup, opt_index); @@ -5610,7 +5610,7 @@ export class TestGroup extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.TestGroup} returns this + * @return {!TestGroup} returns this */ clearRepeatedGroupList() { return this.setRepeatedGroupList([]); @@ -5619,17 +5619,17 @@ export class TestGroup extends jspb.Message { /** * required group RequiredGroup = 2; - * @return {!proto.jspb.test.TestGroup.RequiredGroup} + * @return {!TestGroup.RequiredGroup} */ getRequiredGroup() { - return /** @type{!proto.jspb.test.TestGroup.RequiredGroup} */ ( + return /** @type{!TestGroup.RequiredGroup} */ ( jspb.Message.getWrapperField(this, TestGroup.RequiredGroup, 2, 1)); }; /** - * @param {!proto.jspb.test.TestGroup.RequiredGroup} value - * @return {!proto.jspb.test.TestGroup} returns this + * @param {!TestGroup.RequiredGroup} value + * @return {!TestGroup} returns this */ setRequiredGroup(value) { return jspb.Message.setWrapperField(this, 2, value); @@ -5638,7 +5638,7 @@ export class TestGroup extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestGroup} returns this + * @return {!TestGroup} returns this */ clearRequiredGroup() { return jspb.Message.setField(this, 2, undefined); @@ -5656,17 +5656,17 @@ export class TestGroup extends jspb.Message { /** * optional group OptionalGroup = 3; - * @return {?proto.jspb.test.TestGroup.OptionalGroup} + * @return {?TestGroup.OptionalGroup} */ getOptionalGroup() { - return /** @type{?proto.jspb.test.TestGroup.OptionalGroup} */ ( + return /** @type{?TestGroup.OptionalGroup} */ ( jspb.Message.getWrapperField(this, TestGroup.OptionalGroup, 3)); }; /** - * @param {?proto.jspb.test.TestGroup.OptionalGroup|undefined} value - * @return {!proto.jspb.test.TestGroup} returns this + * @param {?TestGroup.OptionalGroup|undefined} value + * @return {!TestGroup} returns this */ setOptionalGroup(value) { return jspb.Message.setWrapperField(this, 3, value); @@ -5675,7 +5675,7 @@ export class TestGroup extends jspb.Message { /** * Clears the message field making it undefined. - * @return {!proto.jspb.test.TestGroup} returns this + * @return {!TestGroup} returns this */ clearOptionalGroup() { return this.setOptionalGroup(undefined); @@ -5702,7 +5702,7 @@ export class TestGroup extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.TestGroup} returns this + * @return {!TestGroup} returns this */ setId(value) { return jspb.Message.setField(this, 4, value); @@ -5711,7 +5711,7 @@ export class TestGroup extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestGroup} returns this + * @return {!TestGroup} returns this */ clearId() { return jspb.Message.setField(this, 4, undefined); @@ -5729,17 +5729,17 @@ export class TestGroup extends jspb.Message { /** * required Simple2 required_simple = 5; - * @return {!proto.jspb.test.Simple2} + * @return {!Simple2} */ getRequiredSimple() { - return /** @type{!proto.jspb.test.Simple2} */ ( + return /** @type{!Simple2} */ ( jspb.Message.getWrapperField(this, Simple2, 5, 1)); }; /** - * @param {!proto.jspb.test.Simple2} value - * @return {!proto.jspb.test.TestGroup} returns this + * @param {!Simple2} value + * @return {!TestGroup} returns this */ setRequiredSimple(value) { return jspb.Message.setWrapperField(this, 5, value); @@ -5748,7 +5748,7 @@ export class TestGroup extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestGroup} returns this + * @return {!TestGroup} returns this */ clearRequiredSimple() { return jspb.Message.setField(this, 5, undefined); @@ -5766,17 +5766,17 @@ export class TestGroup extends jspb.Message { /** * optional Simple2 optional_simple = 6; - * @return {?proto.jspb.test.Simple2} + * @return {?Simple2} */ getOptionalSimple() { - return /** @type{?proto.jspb.test.Simple2} */ ( + return /** @type{?Simple2} */ ( jspb.Message.getWrapperField(this, Simple2, 6)); }; /** - * @param {?proto.jspb.test.Simple2|undefined} value - * @return {!proto.jspb.test.TestGroup} returns this + * @param {?Simple2|undefined} value + * @return {!TestGroup} returns this */ setOptionalSimple(value) { return jspb.Message.setWrapperField(this, 6, value); @@ -5785,7 +5785,7 @@ export class TestGroup extends jspb.Message { /** * Clears the message field making it undefined. - * @return {!proto.jspb.test.TestGroup} returns this + * @return {!TestGroup} returns this */ clearOptionalSimple() { return this.setOptionalSimple(undefined); @@ -5804,7 +5804,7 @@ export class TestGroup extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestGroup} + * @return {!TestGroup} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -5816,9 +5816,9 @@ export class TestGroup extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestGroup} msg The message object to deserialize into. + * @param {!TestGroup} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestGroup} + * @return {!TestGroup} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -5879,7 +5879,7 @@ export class TestGroup extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestGroup} message + * @param {!TestGroup} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -5976,7 +5976,7 @@ TestGroup.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestGroup} msg The msg instance to transform. + * @param {!TestGroup} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -6024,7 +6024,7 @@ TestGroup.RepeatedGroup = class extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + * @return {!TestGroup.RepeatedGroup} returns this */ setId(value) { return jspb.Message.setField(this, 0, value); @@ -6033,7 +6033,7 @@ TestGroup.RepeatedGroup = class extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + * @return {!TestGroup.RepeatedGroup} returns this */ clearId() { return jspb.Message.setField(this, 0, undefined); @@ -6060,7 +6060,7 @@ TestGroup.RepeatedGroup = class extends jspb.Message { /** * @param {!Array} value - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + * @return {!TestGroup.RepeatedGroup} returns this */ setSomeBoolList(value) { return jspb.Message.setField(this, 1, value || []); @@ -6070,7 +6070,7 @@ TestGroup.RepeatedGroup = class extends jspb.Message { /** * @param {boolean} value * @param {number=} opt_index - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + * @return {!TestGroup.RepeatedGroup} returns this */ addSomeBool(value, opt_index) { return jspb.Message.addToRepeatedField(this, 1, value, opt_index); @@ -6079,7 +6079,7 @@ TestGroup.RepeatedGroup = class extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} returns this + * @return {!TestGroup.RepeatedGroup} returns this */ clearSomeBoolList() { return this.setSomeBoolList([]); @@ -6089,7 +6089,7 @@ TestGroup.RepeatedGroup = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + * @return {!TestGroup.RepeatedGroup} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -6101,9 +6101,9 @@ TestGroup.RepeatedGroup = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestGroup.RepeatedGroup} msg The message object to deserialize into. + * @param {!TestGroup.RepeatedGroup} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestGroup.RepeatedGroup} + * @return {!TestGroup.RepeatedGroup} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -6145,7 +6145,7 @@ TestGroup.RepeatedGroup = class extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestGroup.RepeatedGroup} message + * @param {!TestGroup.RepeatedGroup} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -6209,7 +6209,7 @@ TestGroup.RepeatedGroup.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestGroup.RepeatedGroup} msg The msg instance to transform. + * @param {!TestGroup.RepeatedGroup} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -6252,7 +6252,7 @@ TestGroup.RequiredGroup = class extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this + * @return {!TestGroup.RequiredGroup} returns this */ setId(value) { return jspb.Message.setField(this, -1, value); @@ -6261,7 +6261,7 @@ TestGroup.RequiredGroup = class extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestGroup.RequiredGroup} returns this + * @return {!TestGroup.RequiredGroup} returns this */ clearId() { return jspb.Message.setField(this, -1, undefined); @@ -6280,7 +6280,7 @@ TestGroup.RequiredGroup = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestGroup.RequiredGroup} + * @return {!TestGroup.RequiredGroup} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -6292,9 +6292,9 @@ TestGroup.RequiredGroup = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestGroup.RequiredGroup} msg The message object to deserialize into. + * @param {!TestGroup.RequiredGroup} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestGroup.RequiredGroup} + * @return {!TestGroup.RequiredGroup} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -6330,7 +6330,7 @@ TestGroup.RequiredGroup = class extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestGroup.RequiredGroup} message + * @param {!TestGroup.RequiredGroup} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -6380,7 +6380,7 @@ TestGroup.RequiredGroup.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestGroup.RequiredGroup} msg The msg instance to transform. + * @param {!TestGroup.RequiredGroup} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -6422,7 +6422,7 @@ TestGroup.OptionalGroup = class extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this + * @return {!TestGroup.OptionalGroup} returns this */ setId(value) { return jspb.Message.setField(this, -2, value); @@ -6431,7 +6431,7 @@ TestGroup.OptionalGroup = class extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestGroup.OptionalGroup} returns this + * @return {!TestGroup.OptionalGroup} returns this */ clearId() { return jspb.Message.setField(this, -2, undefined); @@ -6450,7 +6450,7 @@ TestGroup.OptionalGroup = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestGroup.OptionalGroup} + * @return {!TestGroup.OptionalGroup} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -6462,9 +6462,9 @@ TestGroup.OptionalGroup = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestGroup.OptionalGroup} msg The message object to deserialize into. + * @param {!TestGroup.OptionalGroup} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestGroup.OptionalGroup} + * @return {!TestGroup.OptionalGroup} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -6500,7 +6500,7 @@ TestGroup.OptionalGroup = class extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestGroup.OptionalGroup} message + * @param {!TestGroup.OptionalGroup} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -6550,7 +6550,7 @@ TestGroup.OptionalGroup.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestGroup.OptionalGroup} msg The msg instance to transform. + * @param {!TestGroup.OptionalGroup} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -6583,17 +6583,17 @@ export class TestGroup1 extends jspb.Message { }; /** * optional TestGroup.RepeatedGroup group = 1; - * @return {?proto.jspb.test.TestGroup.RepeatedGroup} + * @return {?TestGroup.RepeatedGroup} */ getGroup() { - return /** @type{?proto.jspb.test.TestGroup.RepeatedGroup} */ ( + return /** @type{?TestGroup.RepeatedGroup} */ ( jspb.Message.getWrapperField(this, TestGroup.RepeatedGroup, 1)); }; /** - * @param {?proto.jspb.test.TestGroup.RepeatedGroup|undefined} value - * @return {!proto.jspb.test.TestGroup1} returns this + * @param {?TestGroup.RepeatedGroup|undefined} value + * @return {!TestGroup1} returns this */ setGroup(value) { return jspb.Message.setWrapperField(this, 1, value); @@ -6602,7 +6602,7 @@ export class TestGroup1 extends jspb.Message { /** * Clears the message field making it undefined. - * @return {!proto.jspb.test.TestGroup1} returns this + * @return {!TestGroup1} returns this */ clearGroup() { return this.setGroup(undefined); @@ -6621,7 +6621,7 @@ export class TestGroup1 extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestGroup1} + * @return {!TestGroup1} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -6633,9 +6633,9 @@ export class TestGroup1 extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestGroup1} msg The message object to deserialize into. + * @param {!TestGroup1} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestGroup1} + * @return {!TestGroup1} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -6672,7 +6672,7 @@ export class TestGroup1 extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestGroup1} message + * @param {!TestGroup1} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -6723,7 +6723,7 @@ TestGroup1.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestGroup1} msg The msg instance to transform. + * @param {!TestGroup1} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -6765,7 +6765,7 @@ export class TestReservedNames extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.TestReservedNames} returns this + * @return {!TestReservedNames} returns this */ setExtension$(value) { return jspb.Message.setField(this, 1, value); @@ -6774,7 +6774,7 @@ export class TestReservedNames extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestReservedNames} returns this + * @return {!TestReservedNames} returns this */ clearExtension$() { return jspb.Message.setField(this, 1, undefined); @@ -6793,7 +6793,7 @@ export class TestReservedNames extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestReservedNames} + * @return {!TestReservedNames} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -6805,9 +6805,9 @@ export class TestReservedNames extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestReservedNames} msg The message object to deserialize into. + * @param {!TestReservedNames} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestReservedNames} + * @return {!TestReservedNames} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -6846,7 +6846,7 @@ export class TestReservedNames extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestReservedNames} message + * @param {!TestReservedNames} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -6928,7 +6928,7 @@ TestReservedNames.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestReservedNames} msg The msg instance to transform. + * @param {!TestReservedNames} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -6965,7 +6965,7 @@ export class TestReservedNamesExtension extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestReservedNamesExtension} + * @return {!TestReservedNamesExtension} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -6977,9 +6977,9 @@ export class TestReservedNamesExtension extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestReservedNamesExtension} msg The message object to deserialize into. + * @param {!TestReservedNamesExtension} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestReservedNamesExtension} + * @return {!TestReservedNamesExtension} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -7011,7 +7011,7 @@ export class TestReservedNamesExtension extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestReservedNamesExtension} message + * @param {!TestReservedNamesExtension} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -7067,7 +7067,7 @@ TestReservedNamesExtension.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestReservedNamesExtension} msg The msg instance to transform. + * @param {!TestReservedNamesExtension} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -7112,34 +7112,34 @@ export class TestMessageWithOneof extends jspb.Message { }; /** - * @return {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} + * @return {TestMessageWithOneof.PartialOneofCase} */ getPartialOneofCase() { - return /** @type {proto.jspb.test.TestMessageWithOneof.PartialOneofCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[0])); + return /** @type {TestMessageWithOneof.PartialOneofCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[0])); }; /** - * @return {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} + * @return {TestMessageWithOneof.RecursiveOneofCase} */ getRecursiveOneofCase() { - return /** @type {proto.jspb.test.TestMessageWithOneof.RecursiveOneofCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[1])); + return /** @type {TestMessageWithOneof.RecursiveOneofCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[1])); }; /** - * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} + * @return {TestMessageWithOneof.DefaultOneofACase} */ getDefaultOneofACase() { - return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofACase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[2])); + return /** @type {TestMessageWithOneof.DefaultOneofACase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[2])); }; /** - * @return {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} + * @return {TestMessageWithOneof.DefaultOneofBCase} */ getDefaultOneofBCase() { - return /** @type {proto.jspb.test.TestMessageWithOneof.DefaultOneofBCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[3])); + return /** @type {TestMessageWithOneof.DefaultOneofBCase} */(jspb.Message.computeOneofCase(this, TestMessageWithOneof.oneofGroups_[3])); }; /** @@ -7153,7 +7153,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ setPone(value) { return jspb.Message.setOneofField(this, 3, TestMessageWithOneof.oneofGroups_[0], value); @@ -7162,7 +7162,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ clearPone() { return jspb.Message.setOneofField(this, 3, TestMessageWithOneof.oneofGroups_[0], undefined); @@ -7189,7 +7189,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ setPthree(value) { return jspb.Message.setOneofField(this, 5, TestMessageWithOneof.oneofGroups_[0], value); @@ -7198,7 +7198,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ clearPthree() { return jspb.Message.setOneofField(this, 5, TestMessageWithOneof.oneofGroups_[0], undefined); @@ -7216,17 +7216,17 @@ export class TestMessageWithOneof extends jspb.Message { /** * optional TestMessageWithOneof rone = 6; - * @return {?proto.jspb.test.TestMessageWithOneof} + * @return {?TestMessageWithOneof} */ getRone() { - return /** @type{?proto.jspb.test.TestMessageWithOneof} */ ( + return /** @type{?TestMessageWithOneof} */ ( jspb.Message.getWrapperField(this, TestMessageWithOneof, 6)); }; /** - * @param {?proto.jspb.test.TestMessageWithOneof|undefined} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @param {?TestMessageWithOneof|undefined} value + * @return {!TestMessageWithOneof} returns this */ setRone(value) { return jspb.Message.setOneofWrapperField(this, 6, TestMessageWithOneof.oneofGroups_[1], value); @@ -7235,7 +7235,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * Clears the message field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ clearRone() { return this.setRone(undefined); @@ -7262,7 +7262,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ setRtwo(value) { return jspb.Message.setOneofField(this, 7, TestMessageWithOneof.oneofGroups_[1], value); @@ -7271,7 +7271,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ clearRtwo() { return jspb.Message.setOneofField(this, 7, TestMessageWithOneof.oneofGroups_[1], undefined); @@ -7298,7 +7298,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * @param {boolean} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ setNormalField(value) { return jspb.Message.setField(this, 8, value); @@ -7307,7 +7307,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ clearNormalField() { return jspb.Message.setField(this, 8, undefined); @@ -7334,7 +7334,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * @param {!Array} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ setRepeatedFieldList(value) { return jspb.Message.setField(this, 9, value || []); @@ -7344,7 +7344,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * @param {string} value * @param {number=} opt_index - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ addRepeatedField(value, opt_index) { return jspb.Message.addToRepeatedField(this, 9, value, opt_index); @@ -7353,7 +7353,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * Clears the list making it empty but non-null. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ clearRepeatedFieldList() { return this.setRepeatedFieldList([]); @@ -7371,7 +7371,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ setAone(value) { return jspb.Message.setOneofField(this, 10, TestMessageWithOneof.oneofGroups_[2], value); @@ -7380,7 +7380,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ clearAone() { return jspb.Message.setOneofField(this, 10, TestMessageWithOneof.oneofGroups_[2], undefined); @@ -7407,7 +7407,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ setAtwo(value) { return jspb.Message.setOneofField(this, 11, TestMessageWithOneof.oneofGroups_[2], value); @@ -7416,7 +7416,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ clearAtwo() { return jspb.Message.setOneofField(this, 11, TestMessageWithOneof.oneofGroups_[2], undefined); @@ -7443,7 +7443,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ setBone(value) { return jspb.Message.setOneofField(this, 12, TestMessageWithOneof.oneofGroups_[3], value); @@ -7452,7 +7452,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ clearBone() { return jspb.Message.setOneofField(this, 12, TestMessageWithOneof.oneofGroups_[3], undefined); @@ -7479,7 +7479,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ setBtwo(value) { return jspb.Message.setOneofField(this, 13, TestMessageWithOneof.oneofGroups_[3], value); @@ -7488,7 +7488,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestMessageWithOneof} returns this + * @return {!TestMessageWithOneof} returns this */ clearBtwo() { return jspb.Message.setOneofField(this, 13, TestMessageWithOneof.oneofGroups_[3], undefined); @@ -7507,7 +7507,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestMessageWithOneof} + * @return {!TestMessageWithOneof} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -7519,9 +7519,9 @@ export class TestMessageWithOneof extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestMessageWithOneof} msg The message object to deserialize into. + * @param {!TestMessageWithOneof} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestMessageWithOneof} + * @return {!TestMessageWithOneof} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -7594,7 +7594,7 @@ export class TestMessageWithOneof extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestMessageWithOneof} message + * @param {!TestMessageWithOneof} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -7757,7 +7757,7 @@ TestMessageWithOneof.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestMessageWithOneof} msg The msg instance to transform. + * @param {!TestMessageWithOneof} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -7808,7 +7808,7 @@ export class TestEndsWithBytes extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.TestEndsWithBytes} returns this + * @return {!TestEndsWithBytes} returns this */ setValue(value) { return jspb.Message.setField(this, 1, value); @@ -7817,7 +7817,7 @@ export class TestEndsWithBytes extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestEndsWithBytes} returns this + * @return {!TestEndsWithBytes} returns this */ clearValue() { return jspb.Message.setField(this, 1, undefined); @@ -7868,7 +7868,7 @@ export class TestEndsWithBytes extends jspb.Message { /** * @param {!(string|Uint8Array)} value - * @return {!proto.jspb.test.TestEndsWithBytes} returns this + * @return {!TestEndsWithBytes} returns this */ setData(value) { return jspb.Message.setField(this, 2, value); @@ -7877,7 +7877,7 @@ export class TestEndsWithBytes extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestEndsWithBytes} returns this + * @return {!TestEndsWithBytes} returns this */ clearData() { return jspb.Message.setField(this, 2, undefined); @@ -7896,7 +7896,7 @@ export class TestEndsWithBytes extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestEndsWithBytes} + * @return {!TestEndsWithBytes} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -7908,9 +7908,9 @@ export class TestEndsWithBytes extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestEndsWithBytes} msg The message object to deserialize into. + * @param {!TestEndsWithBytes} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestEndsWithBytes} + * @return {!TestEndsWithBytes} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -7950,7 +7950,7 @@ export class TestEndsWithBytes extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestEndsWithBytes} message + * @param {!TestEndsWithBytes} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -8007,7 +8007,7 @@ TestEndsWithBytes.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestEndsWithBytes} msg The msg instance to transform. + * @param {!TestEndsWithBytes} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -8050,7 +8050,7 @@ export class TestLastFieldBeforePivot extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this + * @return {!TestLastFieldBeforePivot} returns this */ setLastFieldBeforePivot(value) { return jspb.Message.setField(this, 1, value); @@ -8059,7 +8059,7 @@ export class TestLastFieldBeforePivot extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestLastFieldBeforePivot} returns this + * @return {!TestLastFieldBeforePivot} returns this */ clearLastFieldBeforePivot() { return jspb.Message.setField(this, 1, undefined); @@ -8078,7 +8078,7 @@ export class TestLastFieldBeforePivot extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestLastFieldBeforePivot} + * @return {!TestLastFieldBeforePivot} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -8090,9 +8090,9 @@ export class TestLastFieldBeforePivot extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestLastFieldBeforePivot} msg The message object to deserialize into. + * @param {!TestLastFieldBeforePivot} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestLastFieldBeforePivot} + * @return {!TestLastFieldBeforePivot} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -8131,7 +8131,7 @@ export class TestLastFieldBeforePivot extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestLastFieldBeforePivot} message + * @param {!TestLastFieldBeforePivot} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -8213,7 +8213,7 @@ TestLastFieldBeforePivot.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestLastFieldBeforePivot} msg The msg instance to transform. + * @param {!TestLastFieldBeforePivot} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -8258,7 +8258,7 @@ export class Int64Types extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.Int64Types} returns this + * @return {!Int64Types} returns this */ setInt64Normal(value) { return jspb.Message.setField(this, 1, value); @@ -8267,7 +8267,7 @@ export class Int64Types extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.Int64Types} returns this + * @return {!Int64Types} returns this */ clearInt64Normal() { return jspb.Message.setField(this, 1, undefined); @@ -8294,7 +8294,7 @@ export class Int64Types extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.Int64Types} returns this + * @return {!Int64Types} returns this */ setInt64String(value) { return jspb.Message.setField(this, 2, value); @@ -8303,7 +8303,7 @@ export class Int64Types extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.Int64Types} returns this + * @return {!Int64Types} returns this */ clearInt64String() { return jspb.Message.setField(this, 2, undefined); @@ -8330,7 +8330,7 @@ export class Int64Types extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.Int64Types} returns this + * @return {!Int64Types} returns this */ setInt64Number(value) { return jspb.Message.setField(this, 3, value); @@ -8339,7 +8339,7 @@ export class Int64Types extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.Int64Types} returns this + * @return {!Int64Types} returns this */ clearInt64Number() { return jspb.Message.setField(this, 3, undefined); @@ -8358,7 +8358,7 @@ export class Int64Types extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Int64Types} + * @return {!Int64Types} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -8370,9 +8370,9 @@ export class Int64Types extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.Int64Types} msg The message object to deserialize into. + * @param {!Int64Types} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Int64Types} + * @return {!Int64Types} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -8416,7 +8416,7 @@ export class Int64Types extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Int64Types} message + * @param {!Int64Types} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -8480,7 +8480,7 @@ Int64Types.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Int64Types} msg The msg instance to transform. + * @param {!Int64Types} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -8528,7 +8528,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @return {!TestMapFieldsNoBinary} returns this */ clearMapStringStringMapfunction() { this.getMapStringStringMap().clear(); @@ -8551,7 +8551,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @return {!TestMapFieldsNoBinary} returns this */ clearMapStringInt32Mapfunction() { this.getMapStringInt32Map().clear(); @@ -8574,7 +8574,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @return {!TestMapFieldsNoBinary} returns this */ clearMapStringInt64Mapfunction() { this.getMapStringInt64Map().clear(); @@ -8597,7 +8597,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @return {!TestMapFieldsNoBinary} returns this */ clearMapStringBoolMapfunction() { this.getMapStringBoolMap().clear(); @@ -8620,7 +8620,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @return {!TestMapFieldsNoBinary} returns this */ clearMapStringDoubleMapfunction() { this.getMapStringDoubleMap().clear(); @@ -8632,10 +8632,10 @@ export class TestMapFieldsNoBinary extends jspb.Message { * map map_string_enum = 6; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` - * @return {!jspb.Map} + * @return {!jspb.Map} */ getMapStringEnumMap(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( + return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 6, opt_noLazyCreate, null)); }; @@ -8643,7 +8643,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @return {!TestMapFieldsNoBinary} returns this */ clearMapStringEnumMapfunction() { this.getMapStringEnumMap().clear(); @@ -8655,10 +8655,10 @@ export class TestMapFieldsNoBinary extends jspb.Message { * map map_string_msg = 7; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` - * @return {!jspb.Map} + * @return {!jspb.Map} */ getMapStringMsgMap(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( + return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 7, opt_noLazyCreate, MapValueMessageNoBinary)); }; @@ -8666,7 +8666,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @return {!TestMapFieldsNoBinary} returns this */ clearMapStringMsgMapfunction() { this.getMapStringMsgMap().clear(); @@ -8689,7 +8689,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @return {!TestMapFieldsNoBinary} returns this */ clearMapInt32StringMapfunction() { this.getMapInt32StringMap().clear(); @@ -8712,7 +8712,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @return {!TestMapFieldsNoBinary} returns this */ clearMapInt64StringMapfunction() { this.getMapInt64StringMap().clear(); @@ -8735,7 +8735,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @return {!TestMapFieldsNoBinary} returns this */ clearMapBoolStringMapfunction() { this.getMapBoolStringMap().clear(); @@ -8745,17 +8745,17 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * optional TestMapFieldsNoBinary test_map_fields = 11; - * @return {?proto.jspb.test.TestMapFieldsNoBinary} + * @return {?TestMapFieldsNoBinary} */ getTestMapFields() { - return /** @type{?proto.jspb.test.TestMapFieldsNoBinary} */ ( + return /** @type{?TestMapFieldsNoBinary} */ ( jspb.Message.getWrapperField(this, TestMapFieldsNoBinary, 11)); }; /** - * @param {?proto.jspb.test.TestMapFieldsNoBinary|undefined} value - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @param {?TestMapFieldsNoBinary|undefined} value + * @return {!TestMapFieldsNoBinary} returns this */ setTestMapFields(value) { return jspb.Message.setWrapperField(this, 11, value); @@ -8764,7 +8764,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Clears the message field making it undefined. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @return {!TestMapFieldsNoBinary} returns this */ clearTestMapFields() { return this.setTestMapFields(undefined); @@ -8784,10 +8784,10 @@ export class TestMapFieldsNoBinary extends jspb.Message { * map map_string_testmapfields = 12; * @param {boolean=} opt_noLazyCreate Do not create the map if * empty, instead returning `undefined` - * @return {!jspb.Map} + * @return {!jspb.Map} */ getMapStringTestmapfieldsMap(opt_noLazyCreate) { - return /** @type {!jspb.Map} */ ( + return /** @type {!jspb.Map} */ ( jspb.Message.getMapField(this, 12, opt_noLazyCreate, TestMapFieldsNoBinary)); }; @@ -8795,7 +8795,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Clears values from the map. The map will be non-null. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} returns this + * @return {!TestMapFieldsNoBinary} returns this */ clearMapStringTestmapfieldsMapfunction() { this.getMapStringTestmapfieldsMap().clear(); @@ -8806,7 +8806,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} + * @return {!TestMapFieldsNoBinary} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -8818,9 +8818,9 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestMapFieldsNoBinary} msg The message object to deserialize into. + * @param {!TestMapFieldsNoBinary} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestMapFieldsNoBinary} + * @return {!TestMapFieldsNoBinary} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -8923,7 +8923,7 @@ export class TestMapFieldsNoBinary extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestMapFieldsNoBinary} message + * @param {!TestMapFieldsNoBinary} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -9018,7 +9018,7 @@ TestMapFieldsNoBinary.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestMapFieldsNoBinary} msg The msg instance to transform. + * @param {!TestMapFieldsNoBinary} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -9071,7 +9071,7 @@ export class MapValueMessageNoBinary extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this + * @return {!MapValueMessageNoBinary} returns this */ setFoo(value) { return jspb.Message.setField(this, 1, value); @@ -9080,7 +9080,7 @@ export class MapValueMessageNoBinary extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.MapValueMessageNoBinary} returns this + * @return {!MapValueMessageNoBinary} returns this */ clearFoo() { return jspb.Message.setField(this, 1, undefined); @@ -9099,7 +9099,7 @@ export class MapValueMessageNoBinary extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.MapValueMessageNoBinary} + * @return {!MapValueMessageNoBinary} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -9111,9 +9111,9 @@ export class MapValueMessageNoBinary extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.MapValueMessageNoBinary} msg The message object to deserialize into. + * @param {!MapValueMessageNoBinary} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.MapValueMessageNoBinary} + * @return {!MapValueMessageNoBinary} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -9149,7 +9149,7 @@ export class MapValueMessageNoBinary extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.MapValueMessageNoBinary} message + * @param {!MapValueMessageNoBinary} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -9199,7 +9199,7 @@ MapValueMessageNoBinary.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.MapValueMessageNoBinary} msg The msg instance to transform. + * @param {!MapValueMessageNoBinary} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -9233,7 +9233,7 @@ export class Deeply extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Deeply} + * @return {!Deeply} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -9245,9 +9245,9 @@ export class Deeply extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.Deeply} msg The message object to deserialize into. + * @param {!Deeply} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Deeply} + * @return {!Deeply} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -9279,7 +9279,7 @@ export class Deeply extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Deeply} message + * @param {!Deeply} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -9322,7 +9322,7 @@ Deeply.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Deeply} msg The msg instance to transform. + * @param {!Deeply} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -9356,7 +9356,7 @@ Deeply.Nested = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Deeply.Nested} + * @return {!Deeply.Nested} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -9368,9 +9368,9 @@ Deeply.Nested = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.Deeply.Nested} msg The message object to deserialize into. + * @param {!Deeply.Nested} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Deeply.Nested} + * @return {!Deeply.Nested} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -9402,7 +9402,7 @@ Deeply.Nested = class extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Deeply.Nested} message + * @param {!Deeply.Nested} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -9445,7 +9445,7 @@ Deeply.Nested.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Deeply.Nested} msg The msg instance to transform. + * @param {!Deeply.Nested} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -9487,7 +9487,7 @@ Deeply.Nested.Message = class extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.Deeply.Nested.Message} returns this + * @return {!Deeply.Nested.Message} returns this */ setCount(value) { return jspb.Message.setField(this, 1, value); @@ -9496,7 +9496,7 @@ Deeply.Nested.Message = class extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.Deeply.Nested.Message} returns this + * @return {!Deeply.Nested.Message} returns this */ clearCount() { return jspb.Message.setField(this, 1, undefined); @@ -9515,7 +9515,7 @@ Deeply.Nested.Message = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.Deeply.Nested.Message} + * @return {!Deeply.Nested.Message} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -9527,9 +9527,9 @@ Deeply.Nested.Message = class extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.Deeply.Nested.Message} msg The message object to deserialize into. + * @param {!Deeply.Nested.Message} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.Deeply.Nested.Message} + * @return {!Deeply.Nested.Message} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -9565,7 +9565,7 @@ Deeply.Nested.Message = class extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.Deeply.Nested.Message} message + * @param {!Deeply.Nested.Message} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -9615,7 +9615,7 @@ Deeply.Nested.Message.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.Deeply.Nested.Message} msg The msg instance to transform. + * @param {!Deeply.Nested.Message} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -9661,7 +9661,7 @@ export const TestAllowAliasEnum = { /** * A tuple of {field number, class constructor} for the extension * field named `simple1`. - * @type {!jspb.ExtensionFieldInfo} + * @type {!jspb.ExtensionFieldInfo} */ export const simple1 = new jspb.ExtensionFieldInfo( 105, diff --git a/example/test2.js b/example/test2.js index 4d9ca998..12a5a962 100644 --- a/example/test2.js +++ b/example/test2.js @@ -40,7 +40,7 @@ export class TestExtensionsMessage extends jspb.Message { /** * @param {number} value - * @return {!proto.jspb.test.TestExtensionsMessage} returns this + * @return {!TestExtensionsMessage} returns this */ setIntfield(value) { return jspb.Message.setField(this, 1, value); @@ -49,7 +49,7 @@ export class TestExtensionsMessage extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.TestExtensionsMessage} returns this + * @return {!TestExtensionsMessage} returns this */ clearIntfield() { return jspb.Message.setField(this, 1, undefined); @@ -68,7 +68,7 @@ export class TestExtensionsMessage extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.TestExtensionsMessage} + * @return {!TestExtensionsMessage} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -80,9 +80,9 @@ export class TestExtensionsMessage extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.TestExtensionsMessage} msg The message object to deserialize into. + * @param {!TestExtensionsMessage} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.TestExtensionsMessage} + * @return {!TestExtensionsMessage} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -121,7 +121,7 @@ export class TestExtensionsMessage extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.TestExtensionsMessage} message + * @param {!TestExtensionsMessage} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -203,7 +203,7 @@ TestExtensionsMessage.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.TestExtensionsMessage} msg The msg instance to transform. + * @param {!TestExtensionsMessage} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -248,7 +248,7 @@ export class ExtensionMessage extends jspb.Message { /** * @param {string} value - * @return {!proto.jspb.test.ExtensionMessage} returns this + * @return {!ExtensionMessage} returns this */ setExt1(value) { return jspb.Message.setField(this, 1, value); @@ -257,7 +257,7 @@ export class ExtensionMessage extends jspb.Message { /** * Clears the field making it undefined. - * @return {!proto.jspb.test.ExtensionMessage} returns this + * @return {!ExtensionMessage} returns this */ clearExt1() { return jspb.Message.setField(this, 1, undefined); @@ -276,7 +276,7 @@ export class ExtensionMessage extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.ExtensionMessage} + * @return {!ExtensionMessage} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -288,9 +288,9 @@ export class ExtensionMessage extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.ExtensionMessage} msg The message object to deserialize into. + * @param {!ExtensionMessage} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.ExtensionMessage} + * @return {!ExtensionMessage} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -326,7 +326,7 @@ export class ExtensionMessage extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.ExtensionMessage} message + * @param {!ExtensionMessage} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -355,7 +355,7 @@ if (goog.DEBUG && !COMPILED) { /** * A tuple of {field number, class constructor} for the extension * field named `extField`. - * @type {!jspb.ExtensionFieldInfo} + * @type {!jspb.ExtensionFieldInfo} */ ExtensionMessage.extField = new jspb.ExtensionFieldInfo( 100, @@ -389,7 +389,7 @@ ExtensionMessage.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.ExtensionMessage} msg The msg instance to transform. + * @param {!ExtensionMessage} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -434,17 +434,17 @@ export class ForeignNestedFieldMessage extends jspb.Message { }; /** * optional Deeply.Nested.Message deeply_nested_message = 1; - * @return {?proto.jspb.test.Deeply.Nested.Message} + * @return {?protos_test_pb.Deeply.Nested.Message} */ getDeeplyNestedMessage() { - return /** @type{?proto.jspb.test.Deeply.Nested.Message} */ ( + return /** @type{?protos_test_pb.Deeply.Nested.Message} */ ( jspb.Message.getWrapperField(this, protos_test_pb.Deeply.Nested.Message, 1)); }; /** - * @param {?proto.jspb.test.Deeply.Nested.Message|undefined} value - * @return {!proto.jspb.test.ForeignNestedFieldMessage} returns this + * @param {?protos_test_pb.Deeply.Nested.Message|undefined} value + * @return {!ForeignNestedFieldMessage} returns this */ setDeeplyNestedMessage(value) { return jspb.Message.setWrapperField(this, 1, value); @@ -453,7 +453,7 @@ export class ForeignNestedFieldMessage extends jspb.Message { /** * Clears the message field making it undefined. - * @return {!proto.jspb.test.ForeignNestedFieldMessage} returns this + * @return {!ForeignNestedFieldMessage} returns this */ clearDeeplyNestedMessage() { return this.setDeeplyNestedMessage(undefined); @@ -472,7 +472,7 @@ export class ForeignNestedFieldMessage extends jspb.Message { /** * Deserializes binary data (in protobuf wire format). * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.jspb.test.ForeignNestedFieldMessage} + * @return {!ForeignNestedFieldMessage} */ static deserializeBinary(bytes) { var reader = new jspb.BinaryReader(bytes); @@ -484,9 +484,9 @@ export class ForeignNestedFieldMessage extends jspb.Message { /** * Deserializes binary data (in protobuf wire format) from the * given reader into the given message object. - * @param {!proto.jspb.test.ForeignNestedFieldMessage} msg The message object to deserialize into. + * @param {!ForeignNestedFieldMessage} msg The message object to deserialize into. * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.jspb.test.ForeignNestedFieldMessage} + * @return {!ForeignNestedFieldMessage} */ static deserializeBinaryFromReader(msg, reader) { while (reader.nextField()) { @@ -523,7 +523,7 @@ export class ForeignNestedFieldMessage extends jspb.Message { /** * Serializes the given message to binary data (in protobuf wire * format), writing to the given BinaryWriter. - * @param {!proto.jspb.test.ForeignNestedFieldMessage} message + * @param {!ForeignNestedFieldMessage} message * @param {!jspb.BinaryWriter} writer * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -574,7 +574,7 @@ ForeignNestedFieldMessage.prototype.toObject = function(opt_includeInstance) { * @param {boolean|undefined} includeInstance Deprecated. Whether to include * the JSPB instance for transitional soy proto support: * http://goto/soy-param-migration - * @param {!proto.jspb.test.ForeignNestedFieldMessage} msg The msg instance to transform. + * @param {!ForeignNestedFieldMessage} msg The msg instance to transform. * @return {!Object} * @suppress {unusedLocalVariables} f is only used for nested messages */ @@ -595,7 +595,7 @@ deeplyNestedMessage: (f = msg.getDeeplyNestedMessage()) && protos_test_pb.Deeply /** * A tuple of {field number, class constructor} for the extension * field named `floatingMsgField`. - * @type {!jspb.ExtensionFieldInfo} + * @type {!jspb.ExtensionFieldInfo} */ export const floatingMsgField = new jspb.ExtensionFieldInfo( 101, diff --git a/generator/js_generator.cc b/generator/js_generator.cc index ac19ee53..52879530 100644 --- a/generator/js_generator.cc +++ b/generator/js_generator.cc @@ -1046,9 +1046,9 @@ std::string JSTypeName(const GeneratorOptions& options, case FieldDescriptor::CPPTYPE_STRING: return JSStringTypeName(options, field, bytes_mode); case FieldDescriptor::CPPTYPE_ENUM: - return GetQualifiedEnumPath(options, field->enum_type()); + return MaybeCrossFileEnumRef(options, field->file(), field->enum_type()); case FieldDescriptor::CPPTYPE_MESSAGE: - return GetQualifiedMessagePath(options, field->message_type()); + return SubmessageTypeRef(options, field); default: return ""; } @@ -2351,28 +2351,29 @@ void Generator::GenerateOneofCaseDefinition( void Generator::GenerateOneofCaseGetter( const GeneratorOptions& options, io::Printer* printer, const OneofDescriptor* oneof) const { + + std::string classname = LocalMessageRef(options, oneof->containing_type()); printer->Print( "\n" "/**\n" " * @return {$type$.$oneof$Case}\n" " */\n", - "type", GetQualifiedMessagePath(options, oneof->containing_type()), + "type", classname, "oneof", JSOneofName(oneof)); if (options.import_style == GeneratorOptions::kImportEs6) { printer->Print("get$oneof$Case() {\n", "oneof", JSOneofName(oneof)); } else { printer->Print("$class$.prototype.get$oneof$Case = function() {\n", - "class", LocalMessageRef(options, oneof->containing_type()), + "class", classname, "oneof", JSOneofName(oneof)); } printer->Print( - " return /** @type {$type$.$oneof$Case} */(jspb.Message." + " return /** @type {$class$.$oneof$Case} */(jspb.Message." "computeOneofCase(this, $class$.oneofGroups_[$oneofindex$]));\n" "};\n" "\n", - "type", GetQualifiedMessagePath(options, oneof->containing_type()), - "class", LocalMessageRef(options, oneof->containing_type()), "oneof", + "class", classname, "oneof", JSOneofName(oneof), "oneofindex", JSOneofIndex(oneof)); } @@ -2392,6 +2393,7 @@ void Generator::GenerateES6OneOfCaseGetters(const GeneratorOptions& options, void Generator::GenerateClassToObject(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const { + std::string classname = LocalMessageRef(options, desc); printer->Print( "\n" "\n" @@ -2421,14 +2423,13 @@ void Generator::GenerateClassToObject(const GeneratorOptions& options, "include\n" " * the JSPB instance for transitional soy proto support:\n" " * http://goto/soy-param-migration\n" - " * @param {!$typename$} msg The msg instance to transform.\n" + " * @param {!$classname$} msg The msg instance to transform.\n" " * @return {!Object}\n" " * @suppress {unusedLocalVariables} f is only used for nested messages\n" " */\n" "$classname$.toObject = function(includeInstance, msg) {\n" " var f, obj = {", - "classname", LocalMessageRef(options, desc), "typename", - GetQualifiedMessagePath(options, desc)); + "classname", classname); bool first = true; for (int i = 0; i < desc->field_count(); i++) { @@ -2460,7 +2461,7 @@ void Generator::GenerateClassToObject(const GeneratorOptions& options, " $extObject$, $class$.prototype.getExtension,\n" " includeInstance);\n", "extObject", JSExtensionsObjectName(options, desc->file(), desc), - "class", LocalMessageRef(options, desc)); + "class", classname); } printer->Print( @@ -2535,7 +2536,7 @@ void Generator::GenerateClassFieldToObject(const GeneratorOptions& options, std::string value_to_object; if (value_field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) { value_to_object = - LocalMessageRef(options, value_field->message_type()) + ".toObject"; + SubmessageTypeRef(options, value_field) + ".toObject"; } else { value_to_object = "undefined"; } @@ -2595,8 +2596,8 @@ void Generator::GenerateObjectTypedef(const GeneratorOptions& options, const Descriptor* desc) const { // TODO(b/122687752): Consider renaming nested messages called ObjectFormat // to prevent collisions. - const std::string type_name = - LocalMessageRef(options, desc) + ".ObjectFormat"; + const std::string classname = LocalMessageRef(options, desc); + const std::string type_name = classname + ".ObjectFormat"; printer->Print( "/**\n" @@ -2632,14 +2633,13 @@ void Generator::GenerateClassFromObject(const GeneratorOptions& options, printer->Print( "/**\n" " * Loads data from an object into a new instance of this proto.\n" - " * @param {!$typename$.ObjectFormat} obj\n" + " * @param {!$classname$.ObjectFormat} obj\n" " * The object representation of this proto to load the data from.\n" - " * @return {!$typename$}\n" + " * @return {!$classname$}\n" " */\n" "$classname$.fromObject = function(obj) {\n" " var msg = new $classname$();\n", - "classname", LocalMessageRef(options, desc), "typename", - GetQualifiedMessagePath(options, desc)); + "classname", LocalMessageRef(options, desc)); for (int i = 0; i < desc->field_count(); i++) { const FieldDescriptor* field = desc->field(i); @@ -2668,7 +2668,7 @@ void Generator::GenerateClassFieldFromObject( "$fieldclass$.fromObject));\n", "name", JSObjectFieldName(options, field), "index", JSFieldIndex(field), "fieldclass", - LocalMessageRef(options, value_field->message_type())); + SubmessageTypeRef(options, value_field)); } else { // `msg` is a newly-constructed message object that has not yet built any // map containers wrapping underlying arrays, so we can simply directly @@ -2843,7 +2843,6 @@ void Generator::GenerateClassField(const GeneratorOptions& options, printer->Annotate("gettername", field); printer->Print( " return /** @type {!jspb.Map<$keytype$,$valuetype$>} */ (\n", - "class", classname, "keytype", key_type, "valuetype", value_type); printer->Print( @@ -2854,7 +2853,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, printer->Print( ",\n" " $messageType$", - "messageType", LocalMessageRef(options, value_field->message_type())); + "messageType", SubmessageTypeRef(options, value_field)); } else { printer->Print( ",\n" @@ -2918,8 +2917,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, /* is_setter_argument = */ true, /* force_present = */ false, /* singular_if_not_packed = */ false), - "returntype", - GetQualifiedMessagePath(options, field->containing_type())); + "returntype", classname); if (options.import_style == GeneratorOptions::kImportEs6) { printer->Print("$settername$(value) {\n", "settername", settername); @@ -3036,7 +3034,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, " * @param {$optionaltype$} value\n" " * @return {!$class$} returns this\n" " */\n", - "class", GetQualifiedMessagePath(options, field->containing_type()), + "class", classname, "optionaltype", untyped ? "*" : JSFieldTypeAnnotation(options, field, @@ -3088,7 +3086,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, " * Clears the value.\n" " * @return {!$class$} returns this\n" " */\n", - "class", GetQualifiedMessagePath(options, field->containing_type())); + "class", classname); } if (field->is_repeated()) { @@ -3105,7 +3103,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, " * Clears values from the map. The map will be non-null.\n" " * @return {!$returntype$} returns this\n" " */\n", - "returntype", GetQualifiedMessagePath(options, field->containing_type())); + "returntype", classname); if (options.import_style == GeneratorOptions::kImportEs6) { printer->Print("$clearername$function() {\n", "clearername", clearername); @@ -3136,7 +3134,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, "jsdoc", field->is_repeated() ? "Clears the list making it empty but non-null." : "Clears the message field making it undefined.", - "returntype", GetQualifiedMessagePath(options, field->containing_type())); + "returntype", classname); if (options.import_style == GeneratorOptions::kImportEs6) { printer->Print("$clearername$() {\n", "clearername", clearername); @@ -3163,7 +3161,7 @@ void Generator::GenerateClassField(const GeneratorOptions& options, " * Clears the field making it undefined.\n" " * @return {!$returntype$} returns this\n" " */\n", - "returntype", GetQualifiedMessagePath(options, field->containing_type())); + "returntype", classname); if (options.import_style == GeneratorOptions::kImportEs6) { printer->Print("$clearername$() {\n", "clearername", clearername); @@ -3218,6 +3216,7 @@ void Generator::GenerateRepeatedPrimitiveHelperMethods( const GeneratorOptions& options, io::Printer* printer, const FieldDescriptor* field, bool untyped) const { std::string addername = "add" + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list = */ true); + std::string classname = LocalMessageRef(options, field->containing_type()); // clang-format off printer->Print( "/**\n" @@ -3225,7 +3224,7 @@ void Generator::GenerateRepeatedPrimitiveHelperMethods( " * @param {number=} opt_index\n" " * @return {!$returntype$} returns this\n" " */\n", - "returntype", GetQualifiedMessagePath(options, field->containing_type()), + "returntype", classname, "optionaltype", JSFieldTypeAnnotation( options, field, @@ -3239,7 +3238,7 @@ void Generator::GenerateRepeatedPrimitiveHelperMethods( "addername", addername); } else { printer->Print("$class$.prototype.$addername$ = function(value, opt_index) {\n", - "class", LocalMessageRef(options, field->containing_type()), + "class", classname, "addername", addername); } printer->Annotate("addername", field); @@ -3291,13 +3290,14 @@ void Generator::GenerateRepeatedMessageHelperMethods( "\n", "index", JSFieldIndex(field), "oneofgroup", (InRealOneof(field) ? (", " + JSOneofArray(options, field)) : ""), "ctor", - LocalMessageRef(options, field->message_type())); + SubmessageTypeRef(options, field)); } void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const { if (IsExtendable(desc)) { + const std::string classname = LocalMessageRef(options, desc); printer->Print( "\n" "/**\n" @@ -3318,7 +3318,7 @@ void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options, printer->Print("$class$.extensions = {};\n" "\n", - "class", LocalMessageRef(options, desc)); + "class", classname); printer->Print( "\n" @@ -3340,7 +3340,7 @@ void Generator::GenerateClassExtensionFieldInfo(const GeneratorOptions& options, printer->Print("$class$.extensionsBinary = {};\n" "\n", - "class", LocalMessageRef(options, desc)); + "class", classname); } } @@ -3351,14 +3351,13 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options, // by default for 'bytes' fields and packed repeated fields. std::string classname = LocalMessageRef(options, desc); - std::string classtype = GetQualifiedMessagePath(options, desc); printer->Print( "/**\n" " * Deserializes binary data (in protobuf wire format).\n" " * @param {jspb.ByteSource} bytes The bytes to deserialize.\n" - " * @return {!$classtype$}\n" + " * @return {!$classname$}\n" " */\n", - "classtype", classtype); + "classname", classname); if (options.import_style == GeneratorOptions::kImportEs6) { printer->Print("static deserializeBinary(bytes) {\n"); } else { @@ -3375,12 +3374,11 @@ void Generator::GenerateClassDeserializeBinary(const GeneratorOptions& options, "/**\n" " * Deserializes binary data (in protobuf wire format) from the\n" " * given reader into the given message object.\n" - " * @param {!$classtype$} msg The message object to deserialize into.\n" + " * @param {!$classname$} msg The message object to deserialize into.\n" " * @param {!jspb.BinaryReader} reader The BinaryReader to use.\n" - " * @return {!$classtype$}\n" + " * @return {!$classname$}\n" " */\n", - "classname", classname, - "classtype", classtype); + "classname", classname); if (options.import_style == GeneratorOptions::kImportEs6) { printer->Print("static deserializeBinaryFromReader(msg, reader) {\n"); } else { @@ -3449,14 +3447,14 @@ void Generator::GenerateClassDeserializeBinaryField( if (value_field->type() == FieldDescriptor::TYPE_MESSAGE) { printer->Print(", $messageType$.deserializeBinaryFromReader", "messageType", - LocalMessageRef(options, value_field->message_type())); + SubmessageTypeRef(options, value_field)); } else { printer->Print(", null"); } printer->Print(", $defaultKey$", "defaultKey", JSFieldDefault(key_field)); if (value_field->type() == FieldDescriptor::TYPE_MESSAGE) { printer->Print(", new $messageType$()", "messageType", - LocalMessageRef(options, value_field->message_type())); + SubmessageTypeRef(options, value_field)); } else { printer->Print(", $defaultValue$", "defaultValue", JSFieldDefault(value_field)); @@ -3522,7 +3520,6 @@ void Generator::GenerateClassSerializeBinary(const GeneratorOptions& options, io::Printer* printer, const Descriptor* desc) const { std::string classname = LocalMessageRef(options, desc); - std::string classtype = GetQualifiedMessagePath(options, desc); printer->Print( "/**\n" " * Serializes the message to binary data (in protobuf wire format).\n" @@ -3544,12 +3541,11 @@ void Generator::GenerateClassSerializeBinary(const GeneratorOptions& options, "/**\n" " * Serializes the given message to binary data (in protobuf wire\n" " * format), writing to the given BinaryWriter.\n" - " * @param {!$classtype$} message\n" + " * @param {!$classname$} message\n" " * @param {!jspb.BinaryWriter} writer\n" " * @suppress {unusedLocalVariables} f is only used for nested messages\n" " */\n", - "classname", classname, - "classtype", classtype); + "classname", classname); if (options.import_style == GeneratorOptions::kImportEs6) { printer->Print("static serializeBinaryToWriter(message, writer) {\n"); } else { @@ -3569,7 +3565,7 @@ void Generator::GenerateClassSerializeBinary(const GeneratorOptions& options, " jspb.Message.serializeBinaryExtensions(message, writer,\n" " $extobj$Binary, $class$.prototype.getExtension);\n", "extobj", JSExtensionsObjectName(options, desc->file(), desc), "class", - LocalMessageRef(options, desc)); + classname); } printer->Print( @@ -3662,7 +3658,7 @@ void Generator::GenerateClassSerializeBinaryField( if (value_field->type() == FieldDescriptor::TYPE_MESSAGE) { printer->Print(", $messageType$.serializeBinaryToWriter", "messageType", - LocalMessageRef(options, value_field->message_type())); + SubmessageTypeRef(options, value_field)); } printer->Print(");\n"); @@ -4221,6 +4217,7 @@ void Generator::GenerateMessageDTS(const GeneratorOptions& options, return; } + const std::string classname = LocalMessageRef(options, desc); const std::string prefix = IsExportedMessage(options, desc) ? "export " : ""; printer->Print("$prefix$class $classname$ extends jspb.Message {\n", @@ -4246,7 +4243,7 @@ void Generator::GenerateMessageDTS(const GeneratorOptions& options, "serializeBinary(): Uint8Array;\n" "static serializeBinaryToWriter(message: $class$, writer: " "jspb.BinaryWriter): void;\n", - "class", LocalMessageRef(options, desc)); + "class", classname); for (int i = 0; i < desc->field_count(); i++) { if (!IgnoreField(desc->field(i))) { @@ -4260,7 +4257,7 @@ void Generator::GenerateMessageDTS(const GeneratorOptions& options, // ClassName.displayName if (IsExportedMessage(options, desc)) { printer->Print("$prefix$declare namespace $classname$ {\n", - "classname", LocalMessageRef(options, desc), "prefix", prefix); + "classname", classname, "prefix", prefix); printer->Indent(); printer->Print("const displayName: string | undefined;\n"); printer->Outdent(); @@ -4366,8 +4363,7 @@ std::string DTSTypeName(const GeneratorOptions& options, case FieldDescriptor::CPPTYPE_ENUM: return MaybeCrossFileEnumRef(options, field->file(), field->enum_type()); case FieldDescriptor::CPPTYPE_MESSAGE: - return MaybeCrossFileMessageRef(options, field->file(), - field->message_type()); + return SubmessageTypeRef(options, field); default: return ""; } @@ -4414,6 +4410,7 @@ std::string DTSFieldSetterType(const GeneratorOptions& options, void Generator::GenerateFieldDTS(const GeneratorOptions& options, io::Printer* printer, const FieldDescriptor* field) const { + const std::string classname = LocalMessageRef(options, field->containing_type()); if (field->is_map()) { printer->Print( "$gettername$(noLazyCreate?: boolean): " @@ -4429,7 +4426,7 @@ void Generator::GenerateFieldDTS(const GeneratorOptions& options, printer->Print("$settername$(value: $optionaltype$): $class$;\n", "settername", "set" + JSGetterName(options, field), "optionaltype", DTSFieldSetterType(options, field), "class", - LocalMessageRef(options, field->containing_type())); + classname); if (field->is_repeated()) { printer->Print( "$addername$(value?: $optionaltype$, index?: number): " @@ -4462,7 +4459,7 @@ void Generator::GenerateFieldDTS(const GeneratorOptions& options, printer->Print("$settername$(value: $optionaltype$): $class$;\n", "settername", "set" + JSGetterName(options, field), "optionaltype", DTSFieldSetterType(options, field), "class", - LocalMessageRef(options, field->containing_type())); + classname); if (field->is_repeated()) { printer->Print( @@ -4472,7 +4469,7 @@ void Generator::GenerateFieldDTS(const GeneratorOptions& options, "add" + JSGetterName(options, field, BYTES_DEFAULT, /* drop_list = */ true), "optionaltype", DTSFieldType(options, field, BYTES_DEFAULT, true), - "class", LocalMessageRef(options, field->containing_type())); + "class", classname); } } @@ -4482,7 +4479,7 @@ void Generator::GenerateFieldDTS(const GeneratorOptions& options, HasFieldPresence(options, field)) { printer->Print("$clearername$(): $class$;\n", "clearername", "clear" + JSGetterName(options, field), "class", - LocalMessageRef(options, field->containing_type())); + classname); } if (HasFieldPresence(options, field)) {