@@ -13,6 +13,19 @@ NS_ASSUME_NONNULL_BEGIN
13
13
*/
14
14
@interface FEMSerializer : NSObject
15
15
16
+ /* *
17
+ @brief Indicates whether include Null values to the resulting JSON or not. Default is `NO`
18
+
19
+ @discussion In case Object returns `nil` for a specific attribute or relationship FEMSerializer doesn't include it
20
+ into the resulting JSON by default. Settings this property to `YES` forces FEMSerializer to include every nil value as a
21
+ NSNull.
22
+
23
+ For `FEMAttribute` with custom mapping blocks there is a difference in behavior:
24
+
25
+ - when Object returns `nil` value and `includeNulls` set to `NO` then no mapping block i
26
+ - when Object returns `nil` value and `includeNulls` set to `YES` then mapping block invoked with `nil`.
27
+
28
+ */
16
29
@property (nonatomic ) BOOL includeNulls;
17
30
18
31
/* *
@@ -94,16 +107,31 @@ NS_ASSUME_NONNULL_BEGIN
94
107
95
108
@see FEMAttribute
96
109
97
- @return Representation of Object in form of Dictionary.
110
+ @return Representation of the Collection of the Objects in form of Dictionary / Array .
98
111
*/
99
112
- (id )serializeCollection : (NSArray *)collection usingMapping : (FEMMapping *)mapping ;
100
113
101
114
@end
102
115
103
116
@interface FEMSerializer (Shortcut)
104
117
118
+
119
+ /* *
120
+ @brief Shortcut for the `-[FEMSerializer serializeObject:usingMapping:]`
121
+
122
+ @param object Object that is going to be serialized to JSON.
123
+ @param mapping Mapping describing how to map given `object` to JSON.
124
+ @return Representation of Object in form of Dictionary.
125
+ */
105
126
+ (NSDictionary *)serializeObject : (id )object usingMapping : (FEMMapping *)mapping ;
106
127
128
+ /* *
129
+ @brief Shortcut for the `-[FEMSerializer serializeCollection:usingMapping:]`
130
+
131
+ @param collection Collection of Objects that are going to be serialized to the JSON.
132
+ @param mapping Mapping describing how to map given `object` to the JSON.
133
+ @return Representation of the Collection of the Objects in form of Dictionary / Array.
134
+ */
107
135
+ (id )serializeCollection : (NSArray *)collection usingMapping : (FEMMapping *)mapping ;
108
136
109
137
@end
0 commit comments