Skip to content

Commit e25a642

Browse files
author
Dima Zen
committed
Add missing documentation for FEMSerializer
1 parent b674b66 commit e25a642

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

FastEasyMapping/Source/Serializer/FEMSerializer.h

+29-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ NS_ASSUME_NONNULL_BEGIN
1313
*/
1414
@interface FEMSerializer : NSObject
1515

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+
*/
1629
@property (nonatomic) BOOL includeNulls;
1730

1831
/**
@@ -94,16 +107,31 @@ NS_ASSUME_NONNULL_BEGIN
94107
95108
@see FEMAttribute
96109
97-
@return Representation of Object in form of Dictionary.
110+
@return Representation of the Collection of the Objects in form of Dictionary / Array.
98111
*/
99112
- (id)serializeCollection:(NSArray *)collection usingMapping:(FEMMapping *)mapping;
100113

101114
@end
102115

103116
@interface FEMSerializer (Shortcut)
104117

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+
*/
105126
+ (NSDictionary *)serializeObject:(id)object usingMapping:(FEMMapping *)mapping;
106127

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+
*/
107135
+ (id)serializeCollection:(NSArray *)collection usingMapping:(FEMMapping *)mapping;
108136

109137
@end

0 commit comments

Comments
 (0)