mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-21 10:54:31 +08:00
Updated to support setting default value instead of nil when an attribute is missing in the payload. For Core Data backed models, we consult the entity definition to obtain the default value. closes #117
This commit is contained in:
@@ -18,7 +18,7 @@ NSString* const RKObjectMappingNestingAttributeKeyName = @"<RK_NESTING_ATTRIBUTE
|
||||
@synthesize mappings = _mappings;
|
||||
@synthesize dateFormatStrings = _dateFormatStrings;
|
||||
@synthesize rootKeyPath = _rootKeyPath;
|
||||
@synthesize setNilForMissingAttributes = _setNilForMissingAttributes;
|
||||
@synthesize setDefaultValueForMissingAttributes = _setDefaultValueForMissingAttributes;
|
||||
@synthesize setNilForMissingRelationships = _setNilForMissingRelationships;
|
||||
@synthesize forceCollectionMapping = _forceCollectionMapping;
|
||||
|
||||
@@ -33,7 +33,7 @@ NSString* const RKObjectMappingNestingAttributeKeyName = @"<RK_NESTING_ATTRIBUTE
|
||||
if (self) {
|
||||
_mappings = [NSMutableArray new];
|
||||
_dateFormatStrings = [[NSMutableArray alloc] initWithObjects:@"yyyy-MM-dd'T'HH:mm:ss'Z'", @"MM/dd/yyyy", nil];
|
||||
self.setNilForMissingAttributes = NO;
|
||||
self.setDefaultValueForMissingAttributes = NO;
|
||||
self.setNilForMissingRelationships = NO;
|
||||
self.forceCollectionMapping = NO;
|
||||
}
|
||||
@@ -214,4 +214,8 @@ NSString* const RKObjectMappingNestingAttributeKeyName = @"<RK_NESTING_ATTRIBUTE
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (id)defaultValueForMissingAttribute:(NSString*)attributeName {
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user