@@ -256,7 +256,7 @@ public extension Google.Protobuf {
256256 return builderResult. value
257257 }
258258 set ( value) {
259- builderResult. hasValue = true
259+ builderResult. hasValue = value != nil
260260 builderResult. value = value
261261 }
262262 }
@@ -650,68 +650,102 @@ public extension Google.Protobuf {
650650 //OneOf declaration start
651651
652652 public enum Kind {
653- case OneOfKindNotSet
653+ case oneOfKindNotSet
654654
655655 public func checkOneOfIsSet( ) -> Bool {
656656 switch self {
657- case . OneOfKindNotSet : return false
657+ case . oneOfKindNotSet : return false
658658 default : return true
659659 }
660660 }
661- case NullValue ( Google . Protobuf . NullValue )
661+ case nullValue ( Google . Protobuf . NullValue )
662662
663663 public static func getNullValue( _ value: Kind ) -> Google . Protobuf . NullValue ? {
664664 switch value {
665- case . NullValue( let enumValue) : return enumValue
665+ case . nullValue( let enumValue) : return enumValue
666+ default : return nil
667+ }
668+ }
669+ public func getNullValue( ) -> Google . Protobuf . NullValue ? {
670+ switch self {
671+ case . nullValue( let enumValue) : return enumValue
666672 default : return nil
667673 }
668674 }
669- case NumberValue ( Double )
675+ case numberValue ( Double )
670676
671677 public static func getNumberValue( _ value: Kind ) -> Double ? {
672678 switch value {
673- case . NumberValue ( let enumValue ) : return enumValue
679+ case . numberValue ( let otherValue ) : return otherValue
674680 default : return nil
675681 }
676682 }
677- case StringValue( String )
683+ public func getNumberValue( ) -> Double ? {
684+ switch self {
685+ case . numberValue( let otherValue) : return otherValue
686+ default : return nil
687+ }
688+ }
689+ case stringValue( String )
678690
679691 public static func getStringValue( _ value: Kind ) -> String ? {
680692 switch value {
681- case . StringValue( let enumValue) : return enumValue
693+ case . stringValue( let otherValue) : return otherValue
694+ default : return nil
695+ }
696+ }
697+ public func getStringValue( ) -> String ? {
698+ switch self {
699+ case . stringValue( let otherValue) : return otherValue
682700 default : return nil
683701 }
684702 }
685- case BoolValue ( Bool )
703+ case boolValue ( Bool )
686704
687705 public static func getBoolValue( _ value: Kind ) -> Bool ? {
688706 switch value {
689- case . BoolValue( let enumValue) : return enumValue
707+ case . boolValue( let otherValue) : return otherValue
708+ default : return nil
709+ }
710+ }
711+ public func getBoolValue( ) -> Bool ? {
712+ switch self {
713+ case . boolValue( let otherValue) : return otherValue
690714 default : return nil
691715 }
692716 }
693- case StructValue ( Google . Protobuf . Struct )
717+ case structValue ( Google . Protobuf . Struct )
694718
695719 public static func getStructValue( _ value: Kind ) -> Google . Protobuf . Struct ? {
696720 switch value {
697- case . StructValue( let enumValue) :
698- return enumValue
699- default : return nil
721+ case . structValue( let messageValue) : return messageValue
722+ default : return nil
723+ }
724+ }
725+ public func getStructValue( ) -> Google . Protobuf . Struct ? {
726+ switch self {
727+ case . structValue( let messageValue) : return messageValue
728+ default : return nil
700729 }
701730 }
702- case ListValue ( Google . Protobuf . ListValue )
731+ case listValue ( Google . Protobuf . ListValue )
703732
704733 public static func getListValue( _ value: Kind ) -> Google . Protobuf . ListValue ? {
705734 switch value {
706- case . ListValue( let enumValue) :
707- return enumValue
708- default : return nil
735+ case . listValue( let messageValue) : return messageValue
736+ default : return nil
737+ }
738+ }
739+ public func getListValue( ) -> Google . Protobuf . ListValue ? {
740+ switch self {
741+ case . listValue( let messageValue) : return messageValue
742+ default : return nil
709743 }
710744 }
711745 }
712746 //OneOf declaration end
713747
714- fileprivate var storageKind : Value . Kind = Value . Kind. OneOfKindNotSet
748+ fileprivate var storageKind : Value . Kind = Value . Kind. oneOfKindNotSet
715749 public func getOneOfKind( ) -> Value . Kind {
716750 let copyObjectKind = storageKind
717751 return copyObjectKind
@@ -721,15 +755,12 @@ public extension Google.Protobuf {
721755 return Value . Kind. getNullValue ( storageKind)
722756 }
723757 set ( newvalue) {
724- storageKind = Value . Kind. NullValue ( newvalue)
758+ storageKind = Value . Kind. nullValue ( newvalue)
725759 }
726760 }
727761 public fileprivate( set) var hasNullValue : Bool {
728762 get {
729- guard let _ = Value . Kind. getNullValue ( storageKind) else {
730- return false
731- }
732- return true
763+ return Value . Kind. getNullValue ( storageKind) != nil
733764 }
734765 set ( newValue) {
735766 }
@@ -740,15 +771,12 @@ public extension Google.Protobuf {
740771 return Value . Kind. getNumberValue ( storageKind)
741772 }
742773 set ( newvalue) {
743- storageKind = Value . Kind. NumberValue ( newvalue)
774+ storageKind = Value . Kind. numberValue ( newvalue)
744775 }
745776 }
746777 public fileprivate( set) var hasNumberValue : Bool {
747778 get {
748- guard let _ = Value . Kind. getNumberValue ( storageKind) else {
749- return false
750- }
751- return true
779+ return Value . Kind. getNumberValue ( storageKind) != nil
752780 }
753781 set ( newValue) {
754782 }
@@ -759,15 +787,12 @@ public extension Google.Protobuf {
759787 return Value . Kind. getStringValue ( storageKind)
760788 }
761789 set ( newvalue) {
762- storageKind = Value . Kind. StringValue ( newvalue)
790+ storageKind = Value . Kind. stringValue ( newvalue)
763791 }
764792 }
765793 public fileprivate( set) var hasStringValue : Bool {
766794 get {
767- guard let _ = Value . Kind. getStringValue ( storageKind) else {
768- return false
769- }
770- return true
795+ return Value . Kind. getStringValue ( storageKind) != nil
771796 }
772797 set ( newValue) {
773798 }
@@ -778,15 +803,12 @@ public extension Google.Protobuf {
778803 return Value . Kind. getBoolValue ( storageKind)
779804 }
780805 set ( newvalue) {
781- storageKind = Value . Kind. BoolValue ( newvalue)
806+ storageKind = Value . Kind. boolValue ( newvalue)
782807 }
783808 }
784809 public fileprivate( set) var hasBoolValue : Bool {
785810 get {
786- guard let _ = Value . Kind. getBoolValue ( storageKind) else {
787- return false
788- }
789- return true
811+ return Value . Kind. getBoolValue ( storageKind) != nil
790812 }
791813 set ( newValue) {
792814 }
@@ -796,15 +818,12 @@ public extension Google.Protobuf {
796818 return Value . Kind. getStructValue ( storageKind)
797819 }
798820 set ( newvalue) {
799- storageKind = Value . Kind. StructValue ( newvalue)
821+ storageKind = Value . Kind. structValue ( newvalue)
800822 }
801823 }
802824 public fileprivate( set) var hasStructValue : Bool {
803825 get {
804- guard let _ = Value . Kind. getStructValue ( storageKind) else {
805- return false
806- }
807- return true
826+ return Value . Kind. getStructValue ( storageKind) != nil
808827 }
809828 set ( newValue) {
810829 }
@@ -814,15 +833,12 @@ public extension Google.Protobuf {
814833 return Value . Kind. getListValue ( storageKind)
815834 }
816835 set ( newvalue) {
817- storageKind = Value . Kind. ListValue ( newvalue)
836+ storageKind = Value . Kind. listValue ( newvalue)
818837 }
819838 }
820839 public fileprivate( set) var hasListValue : Bool {
821840 get {
822- guard let _ = Value . Kind. getListValue ( storageKind) else {
823- return false
824- }
825- return true
841+ return Value . Kind. getListValue ( storageKind) != nil
826842 }
827843 set ( newValue) {
828844 }
@@ -1018,6 +1034,10 @@ public extension Google.Protobuf {
10181034 required override public init ( ) {
10191035 super. init ( )
10201036 }
1037+ public func setKind( _ oneOf: Value . Kind ) -> Google . Protobuf . Value . Builder {
1038+ builderResult. storageKind = oneOf
1039+ return self
1040+ }
10211041 /// Represents a null value.
10221042 public var nullValue : Google . Protobuf . NullValue {
10231043 get {
@@ -1131,7 +1151,7 @@ public extension Google.Protobuf {
11311151 return builderResult. structValue
11321152 }
11331153 set ( value) {
1134- builderResult. hasStructValue = true
1154+ builderResult. hasStructValue = value != nil
11351155 builderResult. structValue = value
11361156 }
11371157 }
@@ -1186,7 +1206,7 @@ public extension Google.Protobuf {
11861206 return builderResult. listValue
11871207 }
11881208 set ( value) {
1189- builderResult. hasListValue = true
1209+ builderResult. hasListValue = value != nil
11901210 builderResult. listValue = value
11911211 }
11921212 }
0 commit comments