/// Generated by the Protocol Buffers 3.6.0 compiler.  DO NOT EDIT!
/// Protobuf-swift version: 4.0.0
/// Source file "unittest_preserve_unknown_enum.proto"
/// Syntax "Proto3"

import Foundation
import ProtocolBuffers


public struct Proto3PreserveUnknownEnumUnittest { }

public extension Proto3PreserveUnknownEnumUnittest {
    public struct UnittestPreserveUnknownEnumRoot {
        public static let `default` = UnittestPreserveUnknownEnumRoot()
        public var extensionRegistry:ExtensionRegistry

        init() {
            extensionRegistry = ExtensionRegistry()
            registerAllExtensions(registry: extensionRegistry)
        }
        public func registerAllExtensions(registry: ExtensionRegistry) {
        }
    }



    //Enum type declaration start 

    public enum MyEnum:Int32, GeneratedEnum {
        case foo = 0
        case bar = 1
        case baz = 2
        public func toString() -> String {
            switch self {
            case .foo: return "FOO"
            case .bar: return "BAR"
            case .baz: return "BAZ"
            }
        }
        public static func fromString(_ str:String) throws -> Proto3PreserveUnknownEnumUnittest.MyEnum {
            switch str {
            case "FOO":    return .foo
            case "BAR":    return .bar
            case "BAZ":    return .baz
            default: throw ProtocolBuffersError.invalidProtocolBuffer("Conversion failed.")
            }
        }
        public var debugDescription:String { return getDescription() }
        public var description:String { return getDescription() }
        private func getDescription() -> String { 
            switch self {
            case .foo: return ".foo"
            case .bar: return ".bar"
            case .baz: return ".baz"
            }
        }
        public var hashValue:Int {
            return self.rawValue.hashValue
        }
        public static func ==(lhs:MyEnum, rhs:MyEnum) -> Bool {
            return lhs.hashValue == rhs.hashValue
        }
    }

    //Enum type declaration end 



    //Enum type declaration start 

    public enum MyEnumPlusExtra:Int32, GeneratedEnum {
        case eFoo = 0
        case eBar = 1
        case eBaz = 2
        case eExtra = 3
        public func toString() -> String {
            switch self {
            case .eFoo: return "E_FOO"
            case .eBar: return "E_BAR"
            case .eBaz: return "E_BAZ"
            case .eExtra: return "E_EXTRA"
            }
        }
        public static func fromString(_ str:String) throws -> Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra {
            switch str {
            case "E_FOO":    return .eFoo
            case "E_BAR":    return .eBar
            case "E_BAZ":    return .eBaz
            case "E_EXTRA":    return .eExtra
            default: throw ProtocolBuffersError.invalidProtocolBuffer("Conversion failed.")
            }
        }
        public var debugDescription:String { return getDescription() }
        public var description:String { return getDescription() }
        private func getDescription() -> String { 
            switch self {
            case .eFoo: return ".eFoo"
            case .eBar: return ".eBar"
            case .eBaz: return ".eBaz"
            case .eExtra: return ".eExtra"
            }
        }
        public var hashValue:Int {
            return self.rawValue.hashValue
        }
        public static func ==(lhs:MyEnumPlusExtra, rhs:MyEnumPlusExtra) -> Bool {
            return lhs.hashValue == rhs.hashValue
        }
    }

    //Enum type declaration end 

    final public class MyMessage : GeneratedMessage {
        public typealias BuilderType = Proto3PreserveUnknownEnumUnittest.MyMessage.Builder

        public static func == (lhs: Proto3PreserveUnknownEnumUnittest.MyMessage, rhs: Proto3PreserveUnknownEnumUnittest.MyMessage) -> Bool {
            if lhs === rhs {
                return true
            }
            var fieldCheck:Bool = (lhs.hashValue == rhs.hashValue)
            fieldCheck = fieldCheck && (lhs.hasE == rhs.hasE) && (!lhs.hasE || lhs.e == rhs.e)
            fieldCheck = fieldCheck && (lhs.repeatedE == rhs.repeatedE)
            fieldCheck = fieldCheck && (lhs.repeatedPackedE == rhs.repeatedPackedE)
            fieldCheck = fieldCheck && (lhs.repeatedPackedUnexpectedE == rhs.repeatedPackedUnexpectedE)
            fieldCheck = fieldCheck && (lhs.hasOneofE1 == rhs.hasOneofE1) && (!lhs.hasOneofE1 || lhs.oneofE1 == rhs.oneofE1)
            fieldCheck = fieldCheck && (lhs.hasOneofE2 == rhs.hasOneofE2) && (!lhs.hasOneofE2 || lhs.oneofE2 == rhs.oneofE2)
            fieldCheck = (fieldCheck && (lhs.unknownFields == rhs.unknownFields))
            return fieldCheck
        }



        //OneOf declaration start

        public enum O {
            case oneOfONotSet

            public func checkOneOfIsSet() -> Bool {
                switch self {
                case .oneOfONotSet: return false
                default: return true
                }
            }
            case oneofE1(Proto3PreserveUnknownEnumUnittest.MyEnum)

            public static func getOneofE1(_ value:O) -> Proto3PreserveUnknownEnumUnittest.MyEnum? {
                switch value {
                case .oneofE1(let enumValue): return enumValue
                default: return nil
                }
            }
            public func getOneofE1() -> Proto3PreserveUnknownEnumUnittest.MyEnum? {
                switch self {
                case .oneofE1(let enumValue): return enumValue
                default: return nil
                }
            }
            case oneofE2(Proto3PreserveUnknownEnumUnittest.MyEnum)

            public static func getOneofE2(_ value:O) -> Proto3PreserveUnknownEnumUnittest.MyEnum? {
                switch value {
                case .oneofE2(let enumValue): return enumValue
                default: return nil
                }
            }
            public func getOneofE2() -> Proto3PreserveUnknownEnumUnittest.MyEnum? {
                switch self {
                case .oneofE2(let enumValue): return enumValue
                default: return nil
                }
            }
        }
        //OneOf declaration end

        fileprivate var storageO:MyMessage.O =  MyMessage.O.oneOfONotSet
        public func getOneOfO() ->  MyMessage.O {
            let copyObjectO = storageO
            return copyObjectO
        }
        public fileprivate(set) var e:Proto3PreserveUnknownEnumUnittest.MyEnum = Proto3PreserveUnknownEnumUnittest.MyEnum.foo
        public fileprivate(set) var hasE:Bool = false
        private var repeatedEMemoizedSerializedSize:Int32 = 0
        public fileprivate(set) var repeatedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnum> = Array<Proto3PreserveUnknownEnumUnittest.MyEnum>()
        private var repeatedPackedEMemoizedSerializedSize:Int32 = 0
        public fileprivate(set) var repeatedPackedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnum> = Array<Proto3PreserveUnknownEnumUnittest.MyEnum>()
        private var repeatedPackedUnexpectedEMemoizedSerializedSize:Int32 = 0
        public fileprivate(set) var repeatedPackedUnexpectedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> = Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra>()
        public fileprivate(set) var oneofE1:Proto3PreserveUnknownEnumUnittest.MyEnum!{
            get {
                return MyMessage.O.getOneofE1(storageO)
            }
            set (newvalue) {
                storageO = MyMessage.O.oneofE1(newvalue)
            }
        }
        public fileprivate(set) var hasOneofE1:Bool {
            get {
                return MyMessage.O.getOneofE1(storageO) != nil
            }
            set(newValue) {
            }
        }
        public fileprivate(set) var oneofE2:Proto3PreserveUnknownEnumUnittest.MyEnum!{
            get {
                return MyMessage.O.getOneofE2(storageO)
            }
            set (newvalue) {
                storageO = MyMessage.O.oneofE2(newvalue)
            }
        }
        public fileprivate(set) var hasOneofE2:Bool {
            get {
                return MyMessage.O.getOneofE2(storageO) != nil
            }
            set(newValue) {
            }
        }
        required public init() {
            super.init()
        }
        override public func isInitialized() throws {
        }
        override public func writeTo(codedOutputStream: CodedOutputStream) throws {
            if hasE {
                try codedOutputStream.writeEnum(fieldNumber: 1, value:e.rawValue)
            }
            if !repeatedE.isEmpty {
                try codedOutputStream.writeRawVarint32(value: 18)
                try codedOutputStream.writeRawVarint32(value: repeatedEMemoizedSerializedSize)
            }
            for oneValueOfrepeatedE in repeatedE {
                  try codedOutputStream.writeEnumNoTag(value: oneValueOfrepeatedE.rawValue)
            }
            if !repeatedPackedE.isEmpty {
                try codedOutputStream.writeRawVarint32(value: 26)
                try codedOutputStream.writeRawVarint32(value: repeatedPackedEMemoizedSerializedSize)
            }
            for oneValueOfrepeatedPackedE in repeatedPackedE {
                  try codedOutputStream.writeEnumNoTag(value: oneValueOfrepeatedPackedE.rawValue)
            }
            if !repeatedPackedUnexpectedE.isEmpty {
                try codedOutputStream.writeRawVarint32(value: 34)
                try codedOutputStream.writeRawVarint32(value: repeatedPackedUnexpectedEMemoizedSerializedSize)
            }
            for oneValueOfrepeatedPackedUnexpectedE in repeatedPackedUnexpectedE {
                  try codedOutputStream.writeEnumNoTag(value: oneValueOfrepeatedPackedUnexpectedE.rawValue)
            }
            if hasOneofE1 {
                try codedOutputStream.writeEnum(fieldNumber: 5, value:oneofE1.rawValue)
            }
            if hasOneofE2 {
                try codedOutputStream.writeEnum(fieldNumber: 6, value:oneofE2.rawValue)
            }
            try unknownFields.writeTo(codedOutputStream: codedOutputStream)
        }
        override public func serializedSize() -> Int32 {
            var serialize_size:Int32 = memoizedSerializedSize
            if serialize_size != -1 {
             return serialize_size
            }

            serialize_size = 0
            if (hasE) {
                serialize_size += e.rawValue.computeEnumSize(fieldNumber: 1)
            }
            var dataSizerepeatedE:Int32 = 0
            for oneValueOfrepeatedE in repeatedE {
                dataSizerepeatedE += oneValueOfrepeatedE.rawValue.computeEnumSizeNoTag()
            }
            serialize_size += dataSizerepeatedE
            if !repeatedE.isEmpty {
                serialize_size += 1
                serialize_size += dataSizerepeatedE.computeRawVarint32Size()
            }
            repeatedEMemoizedSerializedSize = dataSizerepeatedE
            var dataSizerepeatedPackedE:Int32 = 0
            for oneValueOfrepeatedPackedE in repeatedPackedE {
                dataSizerepeatedPackedE += oneValueOfrepeatedPackedE.rawValue.computeEnumSizeNoTag()
            }
            serialize_size += dataSizerepeatedPackedE
            if !repeatedPackedE.isEmpty {
                serialize_size += 1
                serialize_size += dataSizerepeatedPackedE.computeRawVarint32Size()
            }
            repeatedPackedEMemoizedSerializedSize = dataSizerepeatedPackedE
            var dataSizerepeatedPackedUnexpectedE:Int32 = 0
            for oneValueOfrepeatedPackedUnexpectedE in repeatedPackedUnexpectedE {
                dataSizerepeatedPackedUnexpectedE += oneValueOfrepeatedPackedUnexpectedE.rawValue.computeEnumSizeNoTag()
            }
            serialize_size += dataSizerepeatedPackedUnexpectedE
            if !repeatedPackedUnexpectedE.isEmpty {
                serialize_size += 1
                serialize_size += dataSizerepeatedPackedUnexpectedE.computeRawVarint32Size()
            }
            repeatedPackedUnexpectedEMemoizedSerializedSize = dataSizerepeatedPackedUnexpectedE
            if (hasOneofE1) {
                serialize_size += oneofE1.rawValue.computeEnumSize(fieldNumber: 5)
            }
            if (hasOneofE2) {
                serialize_size += oneofE2.rawValue.computeEnumSize(fieldNumber: 6)
            }
            serialize_size += unknownFields.serializedSize()
            memoizedSerializedSize = serialize_size
            return serialize_size
        }
        public class func getBuilder() -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
            return Proto3PreserveUnknownEnumUnittest.MyMessage.classBuilder() as! Proto3PreserveUnknownEnumUnittest.MyMessage.Builder
        }
        public func getBuilder() -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
            return classBuilder() as! Proto3PreserveUnknownEnumUnittest.MyMessage.Builder
        }
        override public class func classBuilder() -> ProtocolBuffersMessageBuilder {
            return Proto3PreserveUnknownEnumUnittest.MyMessage.Builder()
        }
        override public func classBuilder() -> ProtocolBuffersMessageBuilder {
            return Proto3PreserveUnknownEnumUnittest.MyMessage.Builder()
        }
        public func toBuilder() throws -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
            return try Proto3PreserveUnknownEnumUnittest.MyMessage.builderWithPrototype(prototype:self)
        }
        public class func builderWithPrototype(prototype:Proto3PreserveUnknownEnumUnittest.MyMessage) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
            return try Proto3PreserveUnknownEnumUnittest.MyMessage.Builder().mergeFrom(other:prototype)
        }
        override public func encode() throws -> Dictionary<String,Any> {
            try isInitialized()
            var jsonMap:Dictionary<String,Any> = Dictionary<String,Any>()
            if hasE {
                jsonMap["e"] = e.toString()
            }
            if !repeatedE.isEmpty {
                var jsonArrayRepeatedE:Array<String> = []
                for oneValueRepeatedE in repeatedE {
                    jsonArrayRepeatedE.append(oneValueRepeatedE.toString())
                }
                jsonMap["repeatedE"] = jsonArrayRepeatedE
            }
            if !repeatedPackedE.isEmpty {
                var jsonArrayRepeatedPackedE:Array<String> = []
                for oneValueRepeatedPackedE in repeatedPackedE {
                    jsonArrayRepeatedPackedE.append(oneValueRepeatedPackedE.toString())
                }
                jsonMap["repeatedPackedE"] = jsonArrayRepeatedPackedE
            }
            if !repeatedPackedUnexpectedE.isEmpty {
                var jsonArrayRepeatedPackedUnexpectedE:Array<String> = []
                for oneValueRepeatedPackedUnexpectedE in repeatedPackedUnexpectedE {
                    jsonArrayRepeatedPackedUnexpectedE.append(oneValueRepeatedPackedUnexpectedE.toString())
                }
                jsonMap["repeatedPackedUnexpectedE"] = jsonArrayRepeatedPackedUnexpectedE
            }
            if hasOneofE1 {
                jsonMap["oneofE1"] = oneofE1.toString()
            }
            if hasOneofE2 {
                jsonMap["oneofE2"] = oneofE2.toString()
            }
            return jsonMap
        }
        override class public func decode(jsonMap:Dictionary<String,Any>) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage {
            return try Proto3PreserveUnknownEnumUnittest.MyMessage.Builder.decodeToBuilder(jsonMap:jsonMap).build()
        }
        override class public func fromJSON(data:Data, options: JSONSerialization.ReadingOptions = []) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage {
            return try Proto3PreserveUnknownEnumUnittest.MyMessage.Builder.fromJSONToBuilder(data:data, options:options).build()
        }
        override public func getDescription(indent:String) throws -> String {
            var output = ""
            if (hasE) {
                output += "\(indent) e: \(e.description)\n"
            }
            var repeatedEElementIndex:Int = 0
            for oneValueOfrepeatedE in repeatedE {
                output += "\(indent) repeatedE[\(repeatedEElementIndex)]: \(oneValueOfrepeatedE.description)\n"
                repeatedEElementIndex += 1
            }
            var repeatedPackedEElementIndex:Int = 0
            for oneValueOfrepeatedPackedE in repeatedPackedE {
                output += "\(indent) repeatedPackedE[\(repeatedPackedEElementIndex)]: \(oneValueOfrepeatedPackedE.description)\n"
                repeatedPackedEElementIndex += 1
            }
            var repeatedPackedUnexpectedEElementIndex:Int = 0
            for oneValueOfrepeatedPackedUnexpectedE in repeatedPackedUnexpectedE {
                output += "\(indent) repeatedPackedUnexpectedE[\(repeatedPackedUnexpectedEElementIndex)]: \(oneValueOfrepeatedPackedUnexpectedE.description)\n"
                repeatedPackedUnexpectedEElementIndex += 1
            }
            if (hasOneofE1) {
                output += "\(indent) oneofE1: \(oneofE1.description)\n"
            }
            if (hasOneofE2) {
                output += "\(indent) oneofE2: \(oneofE2.description)\n"
            }
            output += unknownFields.getDescription(indent: indent)
            return output
        }
        override public var hashValue:Int {
            get {
                var hashCode:Int = 7
                if hasE {
                     hashCode = (hashCode &* 31) &+ e.hashValue
                }
                for oneValueOfrepeatedE in repeatedE {
                    hashCode = (hashCode &* 31) &+ oneValueOfrepeatedE.hashValue
                }
                for oneValueOfrepeatedPackedE in repeatedPackedE {
                    hashCode = (hashCode &* 31) &+ oneValueOfrepeatedPackedE.hashValue
                }
                for oneValueOfrepeatedPackedUnexpectedE in repeatedPackedUnexpectedE {
                    hashCode = (hashCode &* 31) &+ oneValueOfrepeatedPackedUnexpectedE.hashValue
                }
                if hasOneofE1 {
                     hashCode = (hashCode &* 31) &+ oneofE1.hashValue
                }
                if hasOneofE2 {
                     hashCode = (hashCode &* 31) &+ oneofE2.hashValue
                }
                hashCode = (hashCode &* 31) &+  unknownFields.hashValue
                return hashCode
            }
        }


        //Meta information declaration start

        override public class func className() -> String {
            return "Proto3PreserveUnknownEnumUnittest.MyMessage"
        }
        override public func className() -> String {
            return "Proto3PreserveUnknownEnumUnittest.MyMessage"
        }
        //Meta information declaration end

        final public class Builder : GeneratedMessageBuilder {
            fileprivate var builderResult:Proto3PreserveUnknownEnumUnittest.MyMessage = Proto3PreserveUnknownEnumUnittest.MyMessage()
            public func getMessage() -> Proto3PreserveUnknownEnumUnittest.MyMessage {
                return builderResult
            }

            required override public init () {
                super.init()
            }
            public func setO(_ oneOf:MyMessage.O) ->  Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                builderResult.storageO = oneOf
                return self
            }
                public var e:Proto3PreserveUnknownEnumUnittest.MyEnum {
                    get {
                        return builderResult.e
                    }
                    set (value) {
                        builderResult.hasE = true
                        builderResult.e = value
                    }
                }
                public var hasE:Bool{
                    get {
                        return builderResult.hasE
                    }
                }
            @discardableResult
                public func setE(_ value:Proto3PreserveUnknownEnumUnittest.MyEnum) -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                  self.e = value
                  return self
                }
            @discardableResult
                public func clearE() -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                   builderResult.hasE = false
                   builderResult.e = .foo
                   return self
                }
            public var repeatedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnum> {
                get {
                    return builderResult.repeatedE
                }
                set (value) {
                    builderResult.repeatedE = value
                }
            }
            @discardableResult
            public func setRepeatedE(_ value:Array<Proto3PreserveUnknownEnumUnittest.MyEnum>) -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                self.repeatedE = value
                return self
            }
            @discardableResult
            public func clearRepeatedE() -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                builderResult.repeatedE.removeAll(keepingCapacity: false)
                return self
            }
            public var repeatedPackedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnum> {
                get {
                    return builderResult.repeatedPackedE
                }
                set (value) {
                    builderResult.repeatedPackedE = value
                }
            }
            @discardableResult
            public func setRepeatedPackedE(_ value:Array<Proto3PreserveUnknownEnumUnittest.MyEnum>) -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                self.repeatedPackedE = value
                return self
            }
            @discardableResult
            public func clearRepeatedPackedE() -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                builderResult.repeatedPackedE.removeAll(keepingCapacity: false)
                return self
            }
            /// not packed
            public var repeatedPackedUnexpectedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> {
                get {
                    return builderResult.repeatedPackedUnexpectedE
                }
                set (value) {
                    builderResult.repeatedPackedUnexpectedE = value
                }
            }
            @discardableResult
            public func setRepeatedPackedUnexpectedE(_ value:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra>) -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                self.repeatedPackedUnexpectedE = value
                return self
            }
            @discardableResult
            public func clearRepeatedPackedUnexpectedE() -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                builderResult.repeatedPackedUnexpectedE.removeAll(keepingCapacity: false)
                return self
            }
                public var oneofE1:Proto3PreserveUnknownEnumUnittest.MyEnum {
                    get {
                        return builderResult.oneofE1
                    }
                    set (value) {
                        builderResult.hasOneofE1 = true
                        builderResult.oneofE1 = value
                    }
                }
                public var hasOneofE1:Bool{
                    get {
                        return builderResult.hasOneofE1
                    }
                }
            @discardableResult
                public func setOneofE1(_ value:Proto3PreserveUnknownEnumUnittest.MyEnum) -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                  self.oneofE1 = value
                  return self
                }
            @discardableResult
                public func clearOneofE1() -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                   builderResult.hasOneofE1 = false
                   builderResult.oneofE1 = .foo
                   return self
                }
                public var oneofE2:Proto3PreserveUnknownEnumUnittest.MyEnum {
                    get {
                        return builderResult.oneofE2
                    }
                    set (value) {
                        builderResult.hasOneofE2 = true
                        builderResult.oneofE2 = value
                    }
                }
                public var hasOneofE2:Bool{
                    get {
                        return builderResult.hasOneofE2
                    }
                }
            @discardableResult
                public func setOneofE2(_ value:Proto3PreserveUnknownEnumUnittest.MyEnum) -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                  self.oneofE2 = value
                  return self
                }
            @discardableResult
                public func clearOneofE2() -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                   builderResult.hasOneofE2 = false
                   builderResult.oneofE2 = .foo
                   return self
                }
            override public var internalGetResult:GeneratedMessage {
                get {
                    return builderResult
                }
            }
            @discardableResult
            override public func clear() -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                builderResult = Proto3PreserveUnknownEnumUnittest.MyMessage()
                return self
            }
            override public func clone() throws -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                return try Proto3PreserveUnknownEnumUnittest.MyMessage.builderWithPrototype(prototype:builderResult)
            }
            override public func build() throws -> Proto3PreserveUnknownEnumUnittest.MyMessage {
                try checkInitialized()
                return buildPartial()
            }
            public func buildPartial() -> Proto3PreserveUnknownEnumUnittest.MyMessage {
                let returnMe:Proto3PreserveUnknownEnumUnittest.MyMessage = builderResult
                return returnMe
            }
            @discardableResult
            public func mergeFrom(other:Proto3PreserveUnknownEnumUnittest.MyMessage) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                if other == Proto3PreserveUnknownEnumUnittest.MyMessage() {
                    return self
                }
                if other.hasE {
                    e = other.e
                }
                if !other.repeatedE.isEmpty {
                     builderResult.repeatedE += other.repeatedE
                }
                if !other.repeatedPackedE.isEmpty {
                     builderResult.repeatedPackedE += other.repeatedPackedE
                }
                if !other.repeatedPackedUnexpectedE.isEmpty {
                     builderResult.repeatedPackedUnexpectedE += other.repeatedPackedUnexpectedE
                }
                if other.hasOneofE1 {
                    oneofE1 = other.oneofE1
                }
                if other.hasOneofE2 {
                    oneofE2 = other.oneofE2
                }
                try merge(unknownField: other.unknownFields)
                return self
            }
            @discardableResult
            override public func mergeFrom(codedInputStream: CodedInputStream) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                return try mergeFrom(codedInputStream: codedInputStream, extensionRegistry:ExtensionRegistry())
            }
            @discardableResult
            override public func mergeFrom(codedInputStream: CodedInputStream, extensionRegistry:ExtensionRegistry) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                let unknownFieldsBuilder:UnknownFieldSet.Builder = try UnknownFieldSet.builderWithUnknownFields(copyFrom:self.unknownFields)
                while (true) {
                    let protobufTag = try codedInputStream.readTag()
                    switch protobufTag {
                    case 0: 
                        self.unknownFields = try unknownFieldsBuilder.build()
                        return self

                    case 8:
                        let valueInte = try codedInputStream.readEnum()
                        if let enumse = Proto3PreserveUnknownEnumUnittest.MyEnum(rawValue:valueInte){
                            e = enumse
                        } else {
                            try unknownFieldsBuilder.mergeVarintField(fieldNumber: 1, value:Int64(valueInte))
                        }

                    case 18:
                        let length = Int(try codedInputStream.readRawVarint32())
                        let oldLimit = try codedInputStream.pushLimit(byteLimit: length)
                        while codedInputStream.bytesUntilLimit() > 0 {
                        let valueIntrepeatedE = try codedInputStream.readEnum()
                        if let enumsrepeatedE = Proto3PreserveUnknownEnumUnittest.MyEnum(rawValue:valueIntrepeatedE) {
                            builderResult.repeatedE.append(enumsrepeatedE)
                        } else {
                            try unknownFieldsBuilder.mergeVarintField(fieldNumber: 2, value:Int64(valueIntrepeatedE))
                        }
                        }
                        codedInputStream.popLimit(oldLimit: oldLimit)

                    case 26:
                        let length = Int(try codedInputStream.readRawVarint32())
                        let oldLimit = try codedInputStream.pushLimit(byteLimit: length)
                        while codedInputStream.bytesUntilLimit() > 0 {
                        let valueIntrepeatedPackedE = try codedInputStream.readEnum()
                        if let enumsrepeatedPackedE = Proto3PreserveUnknownEnumUnittest.MyEnum(rawValue:valueIntrepeatedPackedE) {
                            builderResult.repeatedPackedE.append(enumsrepeatedPackedE)
                        } else {
                            try unknownFieldsBuilder.mergeVarintField(fieldNumber: 3, value:Int64(valueIntrepeatedPackedE))
                        }
                        }
                        codedInputStream.popLimit(oldLimit: oldLimit)

                    case 34:
                        let length = Int(try codedInputStream.readRawVarint32())
                        let oldLimit = try codedInputStream.pushLimit(byteLimit: length)
                        while codedInputStream.bytesUntilLimit() > 0 {
                        let valueIntrepeatedPackedUnexpectedE = try codedInputStream.readEnum()
                        if let enumsrepeatedPackedUnexpectedE = Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra(rawValue:valueIntrepeatedPackedUnexpectedE) {
                            builderResult.repeatedPackedUnexpectedE.append(enumsrepeatedPackedUnexpectedE)
                        } else {
                            try unknownFieldsBuilder.mergeVarintField(fieldNumber: 4, value:Int64(valueIntrepeatedPackedUnexpectedE))
                        }
                        }
                        codedInputStream.popLimit(oldLimit: oldLimit)

                    case 40:
                        let valueIntoneofE1 = try codedInputStream.readEnum()
                        if let enumsoneofE1 = Proto3PreserveUnknownEnumUnittest.MyEnum(rawValue:valueIntoneofE1){
                            oneofE1 = enumsoneofE1
                        } else {
                            try unknownFieldsBuilder.mergeVarintField(fieldNumber: 5, value:Int64(valueIntoneofE1))
                        }

                    case 48:
                        let valueIntoneofE2 = try codedInputStream.readEnum()
                        if let enumsoneofE2 = Proto3PreserveUnknownEnumUnittest.MyEnum(rawValue:valueIntoneofE2){
                            oneofE2 = enumsoneofE2
                        } else {
                            try unknownFieldsBuilder.mergeVarintField(fieldNumber: 6, value:Int64(valueIntoneofE2))
                        }

                    default:
                        if (!(try parse(codedInputStream:codedInputStream, unknownFields:unknownFieldsBuilder, extensionRegistry:extensionRegistry, tag:protobufTag))) {
                            unknownFields = try unknownFieldsBuilder.build()
                            return self
                        }
                    }
                }
            }
            class override public func decodeToBuilder(jsonMap:Dictionary<String,Any>) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                let resultDecodedBuilder = Proto3PreserveUnknownEnumUnittest.MyMessage.Builder()
                if let jsonValueE = jsonMap["e"] as? String {
                    resultDecodedBuilder.e = try Proto3PreserveUnknownEnumUnittest.MyEnum.fromString(jsonValueE)
                }
                if let jsonValueRepeatedE = jsonMap["repeatedE"] as? Array<String> {
                    var jsonArrayRepeatedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnum> = []
                    for oneValueRepeatedE in jsonValueRepeatedE {
                        let enumFromStringRepeatedE = try Proto3PreserveUnknownEnumUnittest.MyEnum.fromString(oneValueRepeatedE)
                        jsonArrayRepeatedE.append(enumFromStringRepeatedE)
                    }
                    resultDecodedBuilder.repeatedE = jsonArrayRepeatedE
                }
                if let jsonValueRepeatedPackedE = jsonMap["repeatedPackedE"] as? Array<String> {
                    var jsonArrayRepeatedPackedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnum> = []
                    for oneValueRepeatedPackedE in jsonValueRepeatedPackedE {
                        let enumFromStringRepeatedPackedE = try Proto3PreserveUnknownEnumUnittest.MyEnum.fromString(oneValueRepeatedPackedE)
                        jsonArrayRepeatedPackedE.append(enumFromStringRepeatedPackedE)
                    }
                    resultDecodedBuilder.repeatedPackedE = jsonArrayRepeatedPackedE
                }
                if let jsonValueRepeatedPackedUnexpectedE = jsonMap["repeatedPackedUnexpectedE"] as? Array<String> {
                    var jsonArrayRepeatedPackedUnexpectedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> = []
                    for oneValueRepeatedPackedUnexpectedE in jsonValueRepeatedPackedUnexpectedE {
                        let enumFromStringRepeatedPackedUnexpectedE = try Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra.fromString(oneValueRepeatedPackedUnexpectedE)
                        jsonArrayRepeatedPackedUnexpectedE.append(enumFromStringRepeatedPackedUnexpectedE)
                    }
                    resultDecodedBuilder.repeatedPackedUnexpectedE = jsonArrayRepeatedPackedUnexpectedE
                }
                if let jsonValueOneofE1 = jsonMap["oneofE1"] as? String {
                    resultDecodedBuilder.oneofE1 = try Proto3PreserveUnknownEnumUnittest.MyEnum.fromString(jsonValueOneofE1)
                }
                if let jsonValueOneofE2 = jsonMap["oneofE2"] as? String {
                    resultDecodedBuilder.oneofE2 = try Proto3PreserveUnknownEnumUnittest.MyEnum.fromString(jsonValueOneofE2)
                }
                return resultDecodedBuilder
            }
            override class public func fromJSONToBuilder(data:Data, options: JSONSerialization.ReadingOptions = []) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage.Builder {
                let jsonData = try JSONSerialization.jsonObject(with:data, options: options)
                guard let jsDataCast = jsonData as? Dictionary<String,Any> else {
                  throw ProtocolBuffersError.invalidProtocolBuffer("Invalid JSON data")
                }
                return try Proto3PreserveUnknownEnumUnittest.MyMessage.Builder.decodeToBuilder(jsonMap:jsDataCast)
            }
        }

    }

    final public class MyMessagePlusExtra : GeneratedMessage {
        public typealias BuilderType = Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder

        public static func == (lhs: Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra, rhs: Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra) -> Bool {
            if lhs === rhs {
                return true
            }
            var fieldCheck:Bool = (lhs.hashValue == rhs.hashValue)
            fieldCheck = fieldCheck && (lhs.hasE == rhs.hasE) && (!lhs.hasE || lhs.e == rhs.e)
            fieldCheck = fieldCheck && (lhs.repeatedE == rhs.repeatedE)
            fieldCheck = fieldCheck && (lhs.repeatedPackedE == rhs.repeatedPackedE)
            fieldCheck = fieldCheck && (lhs.repeatedPackedUnexpectedE == rhs.repeatedPackedUnexpectedE)
            fieldCheck = fieldCheck && (lhs.hasOneofE1 == rhs.hasOneofE1) && (!lhs.hasOneofE1 || lhs.oneofE1 == rhs.oneofE1)
            fieldCheck = fieldCheck && (lhs.hasOneofE2 == rhs.hasOneofE2) && (!lhs.hasOneofE2 || lhs.oneofE2 == rhs.oneofE2)
            fieldCheck = (fieldCheck && (lhs.unknownFields == rhs.unknownFields))
            return fieldCheck
        }



        //OneOf declaration start

        public enum O {
            case oneOfONotSet

            public func checkOneOfIsSet() -> Bool {
                switch self {
                case .oneOfONotSet: return false
                default: return true
                }
            }
            case oneofE1(Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra)

            public static func getOneofE1(_ value:O) -> Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra? {
                switch value {
                case .oneofE1(let enumValue): return enumValue
                default: return nil
                }
            }
            public func getOneofE1() -> Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra? {
                switch self {
                case .oneofE1(let enumValue): return enumValue
                default: return nil
                }
            }
            case oneofE2(Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra)

            public static func getOneofE2(_ value:O) -> Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra? {
                switch value {
                case .oneofE2(let enumValue): return enumValue
                default: return nil
                }
            }
            public func getOneofE2() -> Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra? {
                switch self {
                case .oneofE2(let enumValue): return enumValue
                default: return nil
                }
            }
        }
        //OneOf declaration end

        fileprivate var storageO:MyMessagePlusExtra.O =  MyMessagePlusExtra.O.oneOfONotSet
        public func getOneOfO() ->  MyMessagePlusExtra.O {
            let copyObjectO = storageO
            return copyObjectO
        }
        public fileprivate(set) var e:Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra = Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra.eFoo
        public fileprivate(set) var hasE:Bool = false
        private var repeatedEMemoizedSerializedSize:Int32 = 0
        public fileprivate(set) var repeatedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> = Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra>()
        private var repeatedPackedEMemoizedSerializedSize:Int32 = 0
        public fileprivate(set) var repeatedPackedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> = Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra>()
        private var repeatedPackedUnexpectedEMemoizedSerializedSize:Int32 = 0
        public fileprivate(set) var repeatedPackedUnexpectedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> = Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra>()
        public fileprivate(set) var oneofE1:Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra!{
            get {
                return MyMessagePlusExtra.O.getOneofE1(storageO)
            }
            set (newvalue) {
                storageO = MyMessagePlusExtra.O.oneofE1(newvalue)
            }
        }
        public fileprivate(set) var hasOneofE1:Bool {
            get {
                return MyMessagePlusExtra.O.getOneofE1(storageO) != nil
            }
            set(newValue) {
            }
        }
        public fileprivate(set) var oneofE2:Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra!{
            get {
                return MyMessagePlusExtra.O.getOneofE2(storageO)
            }
            set (newvalue) {
                storageO = MyMessagePlusExtra.O.oneofE2(newvalue)
            }
        }
        public fileprivate(set) var hasOneofE2:Bool {
            get {
                return MyMessagePlusExtra.O.getOneofE2(storageO) != nil
            }
            set(newValue) {
            }
        }
        required public init() {
            super.init()
        }
        override public func isInitialized() throws {
        }
        override public func writeTo(codedOutputStream: CodedOutputStream) throws {
            if hasE {
                try codedOutputStream.writeEnum(fieldNumber: 1, value:e.rawValue)
            }
            if !repeatedE.isEmpty {
                try codedOutputStream.writeRawVarint32(value: 18)
                try codedOutputStream.writeRawVarint32(value: repeatedEMemoizedSerializedSize)
            }
            for oneValueOfrepeatedE in repeatedE {
                  try codedOutputStream.writeEnumNoTag(value: oneValueOfrepeatedE.rawValue)
            }
            if !repeatedPackedE.isEmpty {
                try codedOutputStream.writeRawVarint32(value: 26)
                try codedOutputStream.writeRawVarint32(value: repeatedPackedEMemoizedSerializedSize)
            }
            for oneValueOfrepeatedPackedE in repeatedPackedE {
                  try codedOutputStream.writeEnumNoTag(value: oneValueOfrepeatedPackedE.rawValue)
            }
            if !repeatedPackedUnexpectedE.isEmpty {
                try codedOutputStream.writeRawVarint32(value: 34)
                try codedOutputStream.writeRawVarint32(value: repeatedPackedUnexpectedEMemoizedSerializedSize)
            }
            for oneValueOfrepeatedPackedUnexpectedE in repeatedPackedUnexpectedE {
                  try codedOutputStream.writeEnumNoTag(value: oneValueOfrepeatedPackedUnexpectedE.rawValue)
            }
            if hasOneofE1 {
                try codedOutputStream.writeEnum(fieldNumber: 5, value:oneofE1.rawValue)
            }
            if hasOneofE2 {
                try codedOutputStream.writeEnum(fieldNumber: 6, value:oneofE2.rawValue)
            }
            try unknownFields.writeTo(codedOutputStream: codedOutputStream)
        }
        override public func serializedSize() -> Int32 {
            var serialize_size:Int32 = memoizedSerializedSize
            if serialize_size != -1 {
             return serialize_size
            }

            serialize_size = 0
            if (hasE) {
                serialize_size += e.rawValue.computeEnumSize(fieldNumber: 1)
            }
            var dataSizerepeatedE:Int32 = 0
            for oneValueOfrepeatedE in repeatedE {
                dataSizerepeatedE += oneValueOfrepeatedE.rawValue.computeEnumSizeNoTag()
            }
            serialize_size += dataSizerepeatedE
            if !repeatedE.isEmpty {
                serialize_size += 1
                serialize_size += dataSizerepeatedE.computeRawVarint32Size()
            }
            repeatedEMemoizedSerializedSize = dataSizerepeatedE
            var dataSizerepeatedPackedE:Int32 = 0
            for oneValueOfrepeatedPackedE in repeatedPackedE {
                dataSizerepeatedPackedE += oneValueOfrepeatedPackedE.rawValue.computeEnumSizeNoTag()
            }
            serialize_size += dataSizerepeatedPackedE
            if !repeatedPackedE.isEmpty {
                serialize_size += 1
                serialize_size += dataSizerepeatedPackedE.computeRawVarint32Size()
            }
            repeatedPackedEMemoizedSerializedSize = dataSizerepeatedPackedE
            var dataSizerepeatedPackedUnexpectedE:Int32 = 0
            for oneValueOfrepeatedPackedUnexpectedE in repeatedPackedUnexpectedE {
                dataSizerepeatedPackedUnexpectedE += oneValueOfrepeatedPackedUnexpectedE.rawValue.computeEnumSizeNoTag()
            }
            serialize_size += dataSizerepeatedPackedUnexpectedE
            if !repeatedPackedUnexpectedE.isEmpty {
                serialize_size += 1
                serialize_size += dataSizerepeatedPackedUnexpectedE.computeRawVarint32Size()
            }
            repeatedPackedUnexpectedEMemoizedSerializedSize = dataSizerepeatedPackedUnexpectedE
            if (hasOneofE1) {
                serialize_size += oneofE1.rawValue.computeEnumSize(fieldNumber: 5)
            }
            if (hasOneofE2) {
                serialize_size += oneofE2.rawValue.computeEnumSize(fieldNumber: 6)
            }
            serialize_size += unknownFields.serializedSize()
            memoizedSerializedSize = serialize_size
            return serialize_size
        }
        public class func getBuilder() -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
            return Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.classBuilder() as! Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder
        }
        public func getBuilder() -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
            return classBuilder() as! Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder
        }
        override public class func classBuilder() -> ProtocolBuffersMessageBuilder {
            return Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder()
        }
        override public func classBuilder() -> ProtocolBuffersMessageBuilder {
            return Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder()
        }
        public func toBuilder() throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
            return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.builderWithPrototype(prototype:self)
        }
        public class func builderWithPrototype(prototype:Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
            return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder().mergeFrom(other:prototype)
        }
        override public func encode() throws -> Dictionary<String,Any> {
            try isInitialized()
            var jsonMap:Dictionary<String,Any> = Dictionary<String,Any>()
            if hasE {
                jsonMap["e"] = e.toString()
            }
            if !repeatedE.isEmpty {
                var jsonArrayRepeatedE:Array<String> = []
                for oneValueRepeatedE in repeatedE {
                    jsonArrayRepeatedE.append(oneValueRepeatedE.toString())
                }
                jsonMap["repeatedE"] = jsonArrayRepeatedE
            }
            if !repeatedPackedE.isEmpty {
                var jsonArrayRepeatedPackedE:Array<String> = []
                for oneValueRepeatedPackedE in repeatedPackedE {
                    jsonArrayRepeatedPackedE.append(oneValueRepeatedPackedE.toString())
                }
                jsonMap["repeatedPackedE"] = jsonArrayRepeatedPackedE
            }
            if !repeatedPackedUnexpectedE.isEmpty {
                var jsonArrayRepeatedPackedUnexpectedE:Array<String> = []
                for oneValueRepeatedPackedUnexpectedE in repeatedPackedUnexpectedE {
                    jsonArrayRepeatedPackedUnexpectedE.append(oneValueRepeatedPackedUnexpectedE.toString())
                }
                jsonMap["repeatedPackedUnexpectedE"] = jsonArrayRepeatedPackedUnexpectedE
            }
            if hasOneofE1 {
                jsonMap["oneofE1"] = oneofE1.toString()
            }
            if hasOneofE2 {
                jsonMap["oneofE2"] = oneofE2.toString()
            }
            return jsonMap
        }
        override class public func decode(jsonMap:Dictionary<String,Any>) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra {
            return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder.decodeToBuilder(jsonMap:jsonMap).build()
        }
        override class public func fromJSON(data:Data, options: JSONSerialization.ReadingOptions = []) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra {
            return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder.fromJSONToBuilder(data:data, options:options).build()
        }
        override public func getDescription(indent:String) throws -> String {
            var output = ""
            if (hasE) {
                output += "\(indent) e: \(e.description)\n"
            }
            var repeatedEElementIndex:Int = 0
            for oneValueOfrepeatedE in repeatedE {
                output += "\(indent) repeatedE[\(repeatedEElementIndex)]: \(oneValueOfrepeatedE.description)\n"
                repeatedEElementIndex += 1
            }
            var repeatedPackedEElementIndex:Int = 0
            for oneValueOfrepeatedPackedE in repeatedPackedE {
                output += "\(indent) repeatedPackedE[\(repeatedPackedEElementIndex)]: \(oneValueOfrepeatedPackedE.description)\n"
                repeatedPackedEElementIndex += 1
            }
            var repeatedPackedUnexpectedEElementIndex:Int = 0
            for oneValueOfrepeatedPackedUnexpectedE in repeatedPackedUnexpectedE {
                output += "\(indent) repeatedPackedUnexpectedE[\(repeatedPackedUnexpectedEElementIndex)]: \(oneValueOfrepeatedPackedUnexpectedE.description)\n"
                repeatedPackedUnexpectedEElementIndex += 1
            }
            if (hasOneofE1) {
                output += "\(indent) oneofE1: \(oneofE1.description)\n"
            }
            if (hasOneofE2) {
                output += "\(indent) oneofE2: \(oneofE2.description)\n"
            }
            output += unknownFields.getDescription(indent: indent)
            return output
        }
        override public var hashValue:Int {
            get {
                var hashCode:Int = 7
                if hasE {
                     hashCode = (hashCode &* 31) &+ e.hashValue
                }
                for oneValueOfrepeatedE in repeatedE {
                    hashCode = (hashCode &* 31) &+ oneValueOfrepeatedE.hashValue
                }
                for oneValueOfrepeatedPackedE in repeatedPackedE {
                    hashCode = (hashCode &* 31) &+ oneValueOfrepeatedPackedE.hashValue
                }
                for oneValueOfrepeatedPackedUnexpectedE in repeatedPackedUnexpectedE {
                    hashCode = (hashCode &* 31) &+ oneValueOfrepeatedPackedUnexpectedE.hashValue
                }
                if hasOneofE1 {
                     hashCode = (hashCode &* 31) &+ oneofE1.hashValue
                }
                if hasOneofE2 {
                     hashCode = (hashCode &* 31) &+ oneofE2.hashValue
                }
                hashCode = (hashCode &* 31) &+  unknownFields.hashValue
                return hashCode
            }
        }


        //Meta information declaration start

        override public class func className() -> String {
            return "Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra"
        }
        override public func className() -> String {
            return "Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra"
        }
        //Meta information declaration end

        final public class Builder : GeneratedMessageBuilder {
            fileprivate var builderResult:Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra = Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra()
            public func getMessage() -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra {
                return builderResult
            }

            required override public init () {
                super.init()
            }
            public func setO(_ oneOf:MyMessagePlusExtra.O) ->  Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                builderResult.storageO = oneOf
                return self
            }
                public var e:Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra {
                    get {
                        return builderResult.e
                    }
                    set (value) {
                        builderResult.hasE = true
                        builderResult.e = value
                    }
                }
                public var hasE:Bool{
                    get {
                        return builderResult.hasE
                    }
                }
            @discardableResult
                public func setE(_ value:Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra) -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                  self.e = value
                  return self
                }
            @discardableResult
                public func clearE() -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                   builderResult.hasE = false
                   builderResult.e = .eFoo
                   return self
                }
            public var repeatedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> {
                get {
                    return builderResult.repeatedE
                }
                set (value) {
                    builderResult.repeatedE = value
                }
            }
            @discardableResult
            public func setRepeatedE(_ value:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra>) -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                self.repeatedE = value
                return self
            }
            @discardableResult
            public func clearRepeatedE() -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                builderResult.repeatedE.removeAll(keepingCapacity: false)
                return self
            }
            public var repeatedPackedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> {
                get {
                    return builderResult.repeatedPackedE
                }
                set (value) {
                    builderResult.repeatedPackedE = value
                }
            }
            @discardableResult
            public func setRepeatedPackedE(_ value:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra>) -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                self.repeatedPackedE = value
                return self
            }
            @discardableResult
            public func clearRepeatedPackedE() -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                builderResult.repeatedPackedE.removeAll(keepingCapacity: false)
                return self
            }
            public var repeatedPackedUnexpectedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> {
                get {
                    return builderResult.repeatedPackedUnexpectedE
                }
                set (value) {
                    builderResult.repeatedPackedUnexpectedE = value
                }
            }
            @discardableResult
            public func setRepeatedPackedUnexpectedE(_ value:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra>) -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                self.repeatedPackedUnexpectedE = value
                return self
            }
            @discardableResult
            public func clearRepeatedPackedUnexpectedE() -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                builderResult.repeatedPackedUnexpectedE.removeAll(keepingCapacity: false)
                return self
            }
                public var oneofE1:Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra {
                    get {
                        return builderResult.oneofE1
                    }
                    set (value) {
                        builderResult.hasOneofE1 = true
                        builderResult.oneofE1 = value
                    }
                }
                public var hasOneofE1:Bool{
                    get {
                        return builderResult.hasOneofE1
                    }
                }
            @discardableResult
                public func setOneofE1(_ value:Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra) -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                  self.oneofE1 = value
                  return self
                }
            @discardableResult
                public func clearOneofE1() -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                   builderResult.hasOneofE1 = false
                   builderResult.oneofE1 = .eFoo
                   return self
                }
                public var oneofE2:Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra {
                    get {
                        return builderResult.oneofE2
                    }
                    set (value) {
                        builderResult.hasOneofE2 = true
                        builderResult.oneofE2 = value
                    }
                }
                public var hasOneofE2:Bool{
                    get {
                        return builderResult.hasOneofE2
                    }
                }
            @discardableResult
                public func setOneofE2(_ value:Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra) -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                  self.oneofE2 = value
                  return self
                }
            @discardableResult
                public func clearOneofE2() -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                   builderResult.hasOneofE2 = false
                   builderResult.oneofE2 = .eFoo
                   return self
                }
            override public var internalGetResult:GeneratedMessage {
                get {
                    return builderResult
                }
            }
            @discardableResult
            override public func clear() -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                builderResult = Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra()
                return self
            }
            override public func clone() throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.builderWithPrototype(prototype:builderResult)
            }
            override public func build() throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra {
                try checkInitialized()
                return buildPartial()
            }
            public func buildPartial() -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra {
                let returnMe:Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra = builderResult
                return returnMe
            }
            @discardableResult
            public func mergeFrom(other:Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                if other == Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra() {
                    return self
                }
                if other.hasE {
                    e = other.e
                }
                if !other.repeatedE.isEmpty {
                     builderResult.repeatedE += other.repeatedE
                }
                if !other.repeatedPackedE.isEmpty {
                     builderResult.repeatedPackedE += other.repeatedPackedE
                }
                if !other.repeatedPackedUnexpectedE.isEmpty {
                     builderResult.repeatedPackedUnexpectedE += other.repeatedPackedUnexpectedE
                }
                if other.hasOneofE1 {
                    oneofE1 = other.oneofE1
                }
                if other.hasOneofE2 {
                    oneofE2 = other.oneofE2
                }
                try merge(unknownField: other.unknownFields)
                return self
            }
            @discardableResult
            override public func mergeFrom(codedInputStream: CodedInputStream) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                return try mergeFrom(codedInputStream: codedInputStream, extensionRegistry:ExtensionRegistry())
            }
            @discardableResult
            override public func mergeFrom(codedInputStream: CodedInputStream, extensionRegistry:ExtensionRegistry) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                let unknownFieldsBuilder:UnknownFieldSet.Builder = try UnknownFieldSet.builderWithUnknownFields(copyFrom:self.unknownFields)
                while (true) {
                    let protobufTag = try codedInputStream.readTag()
                    switch protobufTag {
                    case 0: 
                        self.unknownFields = try unknownFieldsBuilder.build()
                        return self

                    case 8:
                        let valueInte = try codedInputStream.readEnum()
                        if let enumse = Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra(rawValue:valueInte){
                            e = enumse
                        } else {
                            try unknownFieldsBuilder.mergeVarintField(fieldNumber: 1, value:Int64(valueInte))
                        }

                    case 18:
                        let length = Int(try codedInputStream.readRawVarint32())
                        let oldLimit = try codedInputStream.pushLimit(byteLimit: length)
                        while codedInputStream.bytesUntilLimit() > 0 {
                        let valueIntrepeatedE = try codedInputStream.readEnum()
                        if let enumsrepeatedE = Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra(rawValue:valueIntrepeatedE) {
                            builderResult.repeatedE.append(enumsrepeatedE)
                        } else {
                            try unknownFieldsBuilder.mergeVarintField(fieldNumber: 2, value:Int64(valueIntrepeatedE))
                        }
                        }
                        codedInputStream.popLimit(oldLimit: oldLimit)

                    case 26:
                        let length = Int(try codedInputStream.readRawVarint32())
                        let oldLimit = try codedInputStream.pushLimit(byteLimit: length)
                        while codedInputStream.bytesUntilLimit() > 0 {
                        let valueIntrepeatedPackedE = try codedInputStream.readEnum()
                        if let enumsrepeatedPackedE = Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra(rawValue:valueIntrepeatedPackedE) {
                            builderResult.repeatedPackedE.append(enumsrepeatedPackedE)
                        } else {
                            try unknownFieldsBuilder.mergeVarintField(fieldNumber: 3, value:Int64(valueIntrepeatedPackedE))
                        }
                        }
                        codedInputStream.popLimit(oldLimit: oldLimit)

                    case 34:
                        let length = Int(try codedInputStream.readRawVarint32())
                        let oldLimit = try codedInputStream.pushLimit(byteLimit: length)
                        while codedInputStream.bytesUntilLimit() > 0 {
                        let valueIntrepeatedPackedUnexpectedE = try codedInputStream.readEnum()
                        if let enumsrepeatedPackedUnexpectedE = Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra(rawValue:valueIntrepeatedPackedUnexpectedE) {
                            builderResult.repeatedPackedUnexpectedE.append(enumsrepeatedPackedUnexpectedE)
                        } else {
                            try unknownFieldsBuilder.mergeVarintField(fieldNumber: 4, value:Int64(valueIntrepeatedPackedUnexpectedE))
                        }
                        }
                        codedInputStream.popLimit(oldLimit: oldLimit)

                    case 40:
                        let valueIntoneofE1 = try codedInputStream.readEnum()
                        if let enumsoneofE1 = Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra(rawValue:valueIntoneofE1){
                            oneofE1 = enumsoneofE1
                        } else {
                            try unknownFieldsBuilder.mergeVarintField(fieldNumber: 5, value:Int64(valueIntoneofE1))
                        }

                    case 48:
                        let valueIntoneofE2 = try codedInputStream.readEnum()
                        if let enumsoneofE2 = Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra(rawValue:valueIntoneofE2){
                            oneofE2 = enumsoneofE2
                        } else {
                            try unknownFieldsBuilder.mergeVarintField(fieldNumber: 6, value:Int64(valueIntoneofE2))
                        }

                    default:
                        if (!(try parse(codedInputStream:codedInputStream, unknownFields:unknownFieldsBuilder, extensionRegistry:extensionRegistry, tag:protobufTag))) {
                            unknownFields = try unknownFieldsBuilder.build()
                            return self
                        }
                    }
                }
            }
            class override public func decodeToBuilder(jsonMap:Dictionary<String,Any>) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                let resultDecodedBuilder = Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder()
                if let jsonValueE = jsonMap["e"] as? String {
                    resultDecodedBuilder.e = try Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra.fromString(jsonValueE)
                }
                if let jsonValueRepeatedE = jsonMap["repeatedE"] as? Array<String> {
                    var jsonArrayRepeatedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> = []
                    for oneValueRepeatedE in jsonValueRepeatedE {
                        let enumFromStringRepeatedE = try Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra.fromString(oneValueRepeatedE)
                        jsonArrayRepeatedE.append(enumFromStringRepeatedE)
                    }
                    resultDecodedBuilder.repeatedE = jsonArrayRepeatedE
                }
                if let jsonValueRepeatedPackedE = jsonMap["repeatedPackedE"] as? Array<String> {
                    var jsonArrayRepeatedPackedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> = []
                    for oneValueRepeatedPackedE in jsonValueRepeatedPackedE {
                        let enumFromStringRepeatedPackedE = try Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra.fromString(oneValueRepeatedPackedE)
                        jsonArrayRepeatedPackedE.append(enumFromStringRepeatedPackedE)
                    }
                    resultDecodedBuilder.repeatedPackedE = jsonArrayRepeatedPackedE
                }
                if let jsonValueRepeatedPackedUnexpectedE = jsonMap["repeatedPackedUnexpectedE"] as? Array<String> {
                    var jsonArrayRepeatedPackedUnexpectedE:Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> = []
                    for oneValueRepeatedPackedUnexpectedE in jsonValueRepeatedPackedUnexpectedE {
                        let enumFromStringRepeatedPackedUnexpectedE = try Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra.fromString(oneValueRepeatedPackedUnexpectedE)
                        jsonArrayRepeatedPackedUnexpectedE.append(enumFromStringRepeatedPackedUnexpectedE)
                    }
                    resultDecodedBuilder.repeatedPackedUnexpectedE = jsonArrayRepeatedPackedUnexpectedE
                }
                if let jsonValueOneofE1 = jsonMap["oneofE1"] as? String {
                    resultDecodedBuilder.oneofE1 = try Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra.fromString(jsonValueOneofE1)
                }
                if let jsonValueOneofE2 = jsonMap["oneofE2"] as? String {
                    resultDecodedBuilder.oneofE2 = try Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra.fromString(jsonValueOneofE2)
                }
                return resultDecodedBuilder
            }
            override class public func fromJSONToBuilder(data:Data, options: JSONSerialization.ReadingOptions = []) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder {
                let jsonData = try JSONSerialization.jsonObject(with:data, options: options)
                guard let jsDataCast = jsonData as? Dictionary<String,Any> else {
                  throw ProtocolBuffersError.invalidProtocolBuffer("Invalid JSON data")
                }
                return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder.decodeToBuilder(jsonMap:jsDataCast)
            }
        }

    }

}
extension Proto3PreserveUnknownEnumUnittest.MyMessage: GeneratedMessageProtocol {
    public class func parseArrayDelimitedFrom(inputStream: InputStream) throws -> Array<Proto3PreserveUnknownEnumUnittest.MyMessage> {
        var mergedArray = Array<Proto3PreserveUnknownEnumUnittest.MyMessage>()
        while let value = try parseDelimitedFrom(inputStream: inputStream) {
          mergedArray.append(value)
        }
        return mergedArray
    }
    public class func parseDelimitedFrom(inputStream: InputStream) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage? {
        return try Proto3PreserveUnknownEnumUnittest.MyMessage.Builder().mergeDelimitedFrom(inputStream: inputStream)?.build()
    }
    public class func parseFrom(data: Data) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage {
        return try Proto3PreserveUnknownEnumUnittest.MyMessage.Builder().mergeFrom(data: data, extensionRegistry:Proto3PreserveUnknownEnumUnittest.UnittestPreserveUnknownEnumRoot.default.extensionRegistry).build()
    }
    public class func parseFrom(data: Data, extensionRegistry:ExtensionRegistry) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage {
        return try Proto3PreserveUnknownEnumUnittest.MyMessage.Builder().mergeFrom(data: data, extensionRegistry:extensionRegistry).build()
    }
    public class func parseFrom(inputStream: InputStream) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage {
        return try Proto3PreserveUnknownEnumUnittest.MyMessage.Builder().mergeFrom(inputStream: inputStream).build()
    }
    public class func parseFrom(inputStream: InputStream, extensionRegistry:ExtensionRegistry) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage {
        return try Proto3PreserveUnknownEnumUnittest.MyMessage.Builder().mergeFrom(inputStream: inputStream, extensionRegistry:extensionRegistry).build()
    }
    public class func parseFrom(codedInputStream: CodedInputStream) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage {
        return try Proto3PreserveUnknownEnumUnittest.MyMessage.Builder().mergeFrom(codedInputStream: codedInputStream).build()
    }
    public class func parseFrom(codedInputStream: CodedInputStream, extensionRegistry:ExtensionRegistry) throws -> Proto3PreserveUnknownEnumUnittest.MyMessage {
        return try Proto3PreserveUnknownEnumUnittest.MyMessage.Builder().mergeFrom(codedInputStream: codedInputStream, extensionRegistry:extensionRegistry).build()
    }
    public subscript(key: String) -> Any? {
        switch key {
        case "e": return self.e
        case "repeatedE": return self.repeatedE
        case "repeatedPackedE": return self.repeatedPackedE
        case "repeatedPackedUnexpectedE": return self.repeatedPackedUnexpectedE
        case "oneofE1": return self.oneofE1
        case "oneofE2": return self.oneofE2
        default: return nil
        }
    }
}
extension Proto3PreserveUnknownEnumUnittest.MyMessage.Builder: GeneratedMessageBuilderProtocol {
    public typealias GeneratedMessageType = Proto3PreserveUnknownEnumUnittest.MyMessage
    public subscript(key: String) -> Any? {
        get { 
            switch key {
            case "e": return self.e
            case "repeatedE": return self.repeatedE
            case "repeatedPackedE": return self.repeatedPackedE
            case "repeatedPackedUnexpectedE": return self.repeatedPackedUnexpectedE
            case "oneofE1": return self.oneofE1
            case "oneofE2": return self.oneofE2
            default: return nil
            }
        }
        set (newSubscriptValue) { 
            switch key {
            case "e":
                guard let newSubscriptValue = newSubscriptValue as? Proto3PreserveUnknownEnumUnittest.MyEnum else {
                    return
                }
                self.e = newSubscriptValue
            case "repeatedE":
                guard let newSubscriptValue = newSubscriptValue as? Array<Proto3PreserveUnknownEnumUnittest.MyEnum> else {
                    return
                }
                self.repeatedE = newSubscriptValue
            case "repeatedPackedE":
                guard let newSubscriptValue = newSubscriptValue as? Array<Proto3PreserveUnknownEnumUnittest.MyEnum> else {
                    return
                }
                self.repeatedPackedE = newSubscriptValue
            case "repeatedPackedUnexpectedE":
                guard let newSubscriptValue = newSubscriptValue as? Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> else {
                    return
                }
                self.repeatedPackedUnexpectedE = newSubscriptValue
            case "oneofE1":
                guard let newSubscriptValue = newSubscriptValue as? Proto3PreserveUnknownEnumUnittest.MyEnum else {
                    return
                }
                self.oneofE1 = newSubscriptValue
            case "oneofE2":
                guard let newSubscriptValue = newSubscriptValue as? Proto3PreserveUnknownEnumUnittest.MyEnum else {
                    return
                }
                self.oneofE2 = newSubscriptValue
            default: return
            }
        }
    }
}
extension Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra: GeneratedMessageProtocol {
    public class func parseArrayDelimitedFrom(inputStream: InputStream) throws -> Array<Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra> {
        var mergedArray = Array<Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra>()
        while let value = try parseDelimitedFrom(inputStream: inputStream) {
          mergedArray.append(value)
        }
        return mergedArray
    }
    public class func parseDelimitedFrom(inputStream: InputStream) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra? {
        return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder().mergeDelimitedFrom(inputStream: inputStream)?.build()
    }
    public class func parseFrom(data: Data) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra {
        return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder().mergeFrom(data: data, extensionRegistry:Proto3PreserveUnknownEnumUnittest.UnittestPreserveUnknownEnumRoot.default.extensionRegistry).build()
    }
    public class func parseFrom(data: Data, extensionRegistry:ExtensionRegistry) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra {
        return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder().mergeFrom(data: data, extensionRegistry:extensionRegistry).build()
    }
    public class func parseFrom(inputStream: InputStream) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra {
        return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder().mergeFrom(inputStream: inputStream).build()
    }
    public class func parseFrom(inputStream: InputStream, extensionRegistry:ExtensionRegistry) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra {
        return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder().mergeFrom(inputStream: inputStream, extensionRegistry:extensionRegistry).build()
    }
    public class func parseFrom(codedInputStream: CodedInputStream) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra {
        return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder().mergeFrom(codedInputStream: codedInputStream).build()
    }
    public class func parseFrom(codedInputStream: CodedInputStream, extensionRegistry:ExtensionRegistry) throws -> Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra {
        return try Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder().mergeFrom(codedInputStream: codedInputStream, extensionRegistry:extensionRegistry).build()
    }
    public subscript(key: String) -> Any? {
        switch key {
        case "e": return self.e
        case "repeatedE": return self.repeatedE
        case "repeatedPackedE": return self.repeatedPackedE
        case "repeatedPackedUnexpectedE": return self.repeatedPackedUnexpectedE
        case "oneofE1": return self.oneofE1
        case "oneofE2": return self.oneofE2
        default: return nil
        }
    }
}
extension Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra.Builder: GeneratedMessageBuilderProtocol {
    public typealias GeneratedMessageType = Proto3PreserveUnknownEnumUnittest.MyMessagePlusExtra
    public subscript(key: String) -> Any? {
        get { 
            switch key {
            case "e": return self.e
            case "repeatedE": return self.repeatedE
            case "repeatedPackedE": return self.repeatedPackedE
            case "repeatedPackedUnexpectedE": return self.repeatedPackedUnexpectedE
            case "oneofE1": return self.oneofE1
            case "oneofE2": return self.oneofE2
            default: return nil
            }
        }
        set (newSubscriptValue) { 
            switch key {
            case "e":
                guard let newSubscriptValue = newSubscriptValue as? Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra else {
                    return
                }
                self.e = newSubscriptValue
            case "repeatedE":
                guard let newSubscriptValue = newSubscriptValue as? Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> else {
                    return
                }
                self.repeatedE = newSubscriptValue
            case "repeatedPackedE":
                guard let newSubscriptValue = newSubscriptValue as? Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> else {
                    return
                }
                self.repeatedPackedE = newSubscriptValue
            case "repeatedPackedUnexpectedE":
                guard let newSubscriptValue = newSubscriptValue as? Array<Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra> else {
                    return
                }
                self.repeatedPackedUnexpectedE = newSubscriptValue
            case "oneofE1":
                guard let newSubscriptValue = newSubscriptValue as? Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra else {
                    return
                }
                self.oneofE1 = newSubscriptValue
            case "oneofE2":
                guard let newSubscriptValue = newSubscriptValue as? Proto3PreserveUnknownEnumUnittest.MyEnumPlusExtra else {
                    return
                }
                self.oneofE2 = newSubscriptValue
            default: return
            }
        }
    }
}

// @@protoc_insertion_point(global_scope)
