diff --git a/example/README.md b/example/README.md new file mode 100644 index 0000000..dcd9d5f --- /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 0000000..b5944de --- /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 0000000..6c46f57 --- /dev/null +++ b/example/test.js @@ -0,0 +1,9992 @@ +// 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.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; diff --git a/generator/js_generator.cc b/generator/js_generator.cc index 6ca0ad3..fcbd3bb 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. @@ -3504,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. @@ -3516,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; } @@ -3540,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; } @@ -3584,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; @@ -3618,12 +3640,19 @@ 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 - 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 @@ -3648,13 +3677,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", "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 +3736,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. @@ -3709,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, @@ -3724,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; @@ -3782,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; @@ -3929,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 98b8126..588d7e0 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 08c3820..5d433dd 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 84bad43..08e494f 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[];