Implemented nested mapping for structures similar to the BuildBot JSON structure. fixes #112

This commit is contained in:
Blake Watters
2011-06-17 11:55:57 -04:00
parent e9e4c83630
commit 3bf4b7bc0f
18 changed files with 3342 additions and 77 deletions

View File

@@ -9,6 +9,9 @@
#import "RKObjectMapping.h"
#import "RKObjectRelationshipMapping.h"
// Constants
NSString* const RKObjectMappingNestingAttributeKeyName = @"<RK_NESTING_ATTRIBUTE>";
@implementation RKObjectMapping
@synthesize objectClass = _objectClass;
@@ -17,6 +20,7 @@
@synthesize rootKeyPath = _rootKeyPath;
@synthesize setNilForMissingAttributes = _setNilForMissingAttributes;
@synthesize setNilForMissingRelationships = _setNilForMissingRelationships;
@synthesize forceCollectionMapping = _forceCollectionMapping;
+ (id)mappingForClass:(Class)objectClass {
RKObjectMapping* mapping = [self new];
@@ -31,6 +35,7 @@
_dateFormatStrings = [[NSMutableArray alloc] initWithObjects:@"yyyy-MM-dd'T'HH:mm:ss'Z'", @"MM/dd/yyyy", nil];
self.setNilForMissingAttributes = NO;
self.setNilForMissingRelationships = NO;
self.forceCollectionMapping = NO;
}
return self;
@@ -185,4 +190,8 @@
va_end(args);
}
- (void)mapKeyOfNestedDictionaryToAttribute:(NSString*)attributeName {
[self mapKeyPath:RKObjectMappingNestingAttributeKeyName toAttribute:attributeName];
}
@end