66// Copyright (c) 2014 hearst. All rights reserved.
77//
88
9- import Foundation
10-
119/**
1210* This file defines a new operator which is used to create a mapping between an object and a JSON key value.
1311* There is an overloaded operator definition for each type of object that is supported in ObjectMapper.
@@ -23,9 +21,9 @@ infix operator <- {}
2321
2422public func <- < T> ( inout left: T , right: Map ) {
2523 if right. mappingType == MappingType . fromJSON {
26- FromJSON ( ) . basicType ( & left, object: right. currentValue)
24+ FromJSON . basicType ( & left, object: right. currentValue)
2725 } else {
28- ToJSON ( ) . basicType ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
26+ ToJSON . basicType ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
2927 }
3028}
3129
@@ -34,9 +32,9 @@ public func <- <T>(inout left: T, right: Map) {
3432*/
3533public func <- < T> ( inout left: T ? , right: Map ) {
3634 if right. mappingType == MappingType . fromJSON {
37- FromJSON ( ) . optionalBasicType ( & left, object: right. currentValue)
35+ FromJSON . optionalBasicType ( & left, object: right. currentValue)
3836 } else {
39- ToJSON ( ) . optionalBasicType ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
37+ ToJSON . optionalBasicType ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
4038 }
4139}
4240
@@ -45,9 +43,9 @@ public func <- <T>(inout left: T?, right: Map) {
4543*/
4644public func <- < T> ( inout left: T ! , right: Map ) {
4745 if right. mappingType == MappingType . fromJSON {
48- FromJSON ( ) . optionalBasicType ( & left, object: right. currentValue)
46+ FromJSON . optionalBasicType ( & left, object: right. currentValue)
4947 } else {
50- ToJSON ( ) . optionalBasicType ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
48+ ToJSON . optionalBasicType ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
5149 }
5250}
5351
@@ -57,10 +55,10 @@ public func <- <T>(inout left: T!, right: Map) {
5755public func <- < T, Transform: TransformType where Transform. Object == T > ( inout left: T , right: ( Map , Transform ) ) {
5856 if right. 0 . mappingType == MappingType . fromJSON {
5957 var value : T ? = right. 1 . transformFromJSON ( right. 0 . currentValue)
60- FromJSON ( ) . basicType ( & left, object: value)
58+ FromJSON . basicType ( & left, object: value)
6159 } else {
6260 var value : Transform . JSON ? = right. 1 . transformToJSON ( left)
63- ToJSON ( ) . optionalBasicType ( value, key: right. 0 . currentKey!, dictionary: & right. 0 . JSONDictionary)
61+ ToJSON . optionalBasicType ( value, key: right. 0 . currentKey!, dictionary: & right. 0 . JSONDictionary)
6462 }
6563}
6664
@@ -70,10 +68,10 @@ public func <- <T, Transform: TransformType where Transform.Object == T>(inout l
7068public func <- < T, Transform: TransformType where Transform. Object == T > ( inout left: T ? , right: ( Map , Transform ) ) {
7169 if right. 0 . mappingType == MappingType . fromJSON {
7270 var value : T ? = right. 1 . transformFromJSON ( right. 0 . currentValue)
73- FromJSON ( ) . optionalBasicType ( & left, object: value)
71+ FromJSON . optionalBasicType ( & left, object: value)
7472 } else {
7573 var value : Transform . JSON ? = right. 1 . transformToJSON ( left)
76- ToJSON ( ) . optionalBasicType ( value, key: right. 0 . currentKey!, dictionary: & right. 0 . JSONDictionary)
74+ ToJSON . optionalBasicType ( value, key: right. 0 . currentKey!, dictionary: & right. 0 . JSONDictionary)
7775 }
7876}
7977
@@ -83,10 +81,10 @@ public func <- <T, Transform: TransformType where Transform.Object == T>(inout l
8381public func <- < T, Transform: TransformType where Transform. Object == T > ( inout left: T ! , right: ( Map , Transform ) ) {
8482 if right. 0 . mappingType == MappingType . fromJSON {
8583 var value : T ? = right. 1 . transformFromJSON ( right. 0 . currentValue)
86- FromJSON ( ) . optionalBasicType ( & left, object: value)
84+ FromJSON . optionalBasicType ( & left, object: value)
8785 } else {
8886 var value : Transform . JSON ? = right. 1 . transformToJSON ( left)
89- ToJSON ( ) . optionalBasicType ( value, key: right. 0 . currentKey!, dictionary: & right. 0 . JSONDictionary)
87+ ToJSON . optionalBasicType ( value, key: right. 0 . currentKey!, dictionary: & right. 0 . JSONDictionary)
9088 }
9189}
9290
@@ -96,9 +94,9 @@ public func <- <T, Transform: TransformType where Transform.Object == T>(inout l
9694*/
9795public func <- < T: Mappable > ( inout left: T , right: Map ) {
9896 if right. mappingType == MappingType . fromJSON {
99- FromJSON ( ) . object ( & left, object: right. currentValue)
97+ FromJSON . object ( & left, object: right. currentValue)
10098 } else {
101- ToJSON ( ) . object ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
99+ ToJSON . object ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
102100 }
103101}
104102
@@ -107,9 +105,9 @@ public func <- <T: Mappable>(inout left: T, right: Map) {
107105*/
108106public func <- < T: Mappable > ( inout left: T ? , right: Map ) {
109107 if right. mappingType == MappingType . fromJSON {
110- FromJSON ( ) . optionalObject ( & left, object: right. currentValue)
108+ FromJSON . optionalObject ( & left, object: right. currentValue)
111109 } else {
112- ToJSON ( ) . optionalObject ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
110+ ToJSON . optionalObject ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
113111 }
114112}
115113
@@ -118,9 +116,9 @@ public func <- <T: Mappable>(inout left: T?, right: Map) {
118116*/
119117public func <- < T: Mappable > ( inout left: T ! , right: Map ) {
120118 if right. mappingType == MappingType . fromJSON {
121- FromJSON ( ) . optionalObject ( & left, object: right. currentValue)
119+ FromJSON . optionalObject ( & left, object: right. currentValue)
122120 } else {
123- ToJSON ( ) . optionalObject ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
121+ ToJSON . optionalObject ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
124122 }
125123}
126124
@@ -130,9 +128,9 @@ public func <- <T: Mappable>(inout left: T!, right: Map) {
130128*/
131129public func <- < T: Mappable > ( inout left: Dictionary < String , T > , right: Map ) {
132130 if right. mappingType == MappingType . fromJSON {
133- FromJSON ( ) . objectDictionary ( & left, object: right. currentValue)
131+ FromJSON . objectDictionary ( & left, object: right. currentValue)
134132 } else {
135- ToJSON ( ) . objectDictionary ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
133+ ToJSON . objectDictionary ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
136134 }
137135}
138136
@@ -141,9 +139,9 @@ public func <- <T: Mappable>(inout left: Dictionary<String, T>, right: Map) {
141139*/
142140public func <- < T: Mappable > ( inout left: Dictionary < String , T > ? , right: Map ) {
143141 if right. mappingType == MappingType . fromJSON {
144- FromJSON ( ) . optionalObjectDictionary ( & left, object: right. currentValue)
142+ FromJSON . optionalObjectDictionary ( & left, object: right. currentValue)
145143 } else {
146- ToJSON ( ) . optionalObjectDictionary ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
144+ ToJSON . optionalObjectDictionary ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
147145 }
148146}
149147
@@ -152,9 +150,9 @@ public func <- <T: Mappable>(inout left: Dictionary<String, T>?, right: Map) {
152150*/
153151public func <- < T: Mappable > ( inout left: Dictionary < String , T > ! , right: Map ) {
154152 if right. mappingType == MappingType . fromJSON {
155- FromJSON ( ) . optionalObjectDictionary ( & left, object: right. currentValue)
153+ FromJSON . optionalObjectDictionary ( & left, object: right. currentValue)
156154 } else {
157- ToJSON ( ) . optionalObjectDictionary ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
155+ ToJSON . optionalObjectDictionary ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
158156 }
159157}
160158
@@ -164,9 +162,9 @@ public func <- <T: Mappable>(inout left: Dictionary<String, T>!, right: Map) {
164162*/
165163public func <- < T: Mappable > ( inout left: Array < T > , right: Map ) {
166164 if right. mappingType == MappingType . fromJSON {
167- FromJSON ( ) . objectArray ( & left, object: right. currentValue)
165+ FromJSON . objectArray ( & left, object: right. currentValue)
168166 } else {
169- ToJSON ( ) . objectArray ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
167+ ToJSON . objectArray ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
170168 }
171169}
172170
@@ -175,9 +173,9 @@ public func <- <T: Mappable>(inout left: Array<T>, right: Map) {
175173*/
176174public func <- < T: Mappable > ( inout left: Array < T > ? , right: Map ) {
177175 if right. mappingType == MappingType . fromJSON {
178- FromJSON ( ) . optionalObjectArray ( & left, object: right. currentValue)
176+ FromJSON . optionalObjectArray ( & left, object: right. currentValue)
179177 } else {
180- ToJSON ( ) . optionalObjectArray ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
178+ ToJSON . optionalObjectArray ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
181179 }
182180}
183181
@@ -186,8 +184,8 @@ public func <- <T: Mappable>(inout left: Array<T>?, right: Map) {
186184*/
187185public func <- < T: Mappable > ( inout left: Array < T > ! , right: Map ) {
188186 if right. mappingType == MappingType . fromJSON {
189- FromJSON ( ) . optionalObjectArray ( & left, object: right. currentValue)
187+ FromJSON . optionalObjectArray ( & left, object: right. currentValue)
190188 } else {
191- ToJSON ( ) . optionalObjectArray ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
189+ ToJSON . optionalObjectArray ( left, key: right. currentKey!, dictionary: & right. JSONDictionary)
192190 }
193191}
0 commit comments