Add support for performing object mapping with type transformations across relationships defined with keyPaths

This commit is contained in:
Blake Watters
2012-08-31 16:20:07 -04:00
parent a59ced28a5
commit 2cf16be6cb
3 changed files with 22 additions and 6 deletions

View File

@@ -270,6 +270,18 @@ NSString * const RKObjectMappingNestingAttributeKeyName = @"<RK_NESTING_ATTRIBUT
return [[RKPropertyInspector sharedInspector] typeForProperty:propertyName ofClass:self.objectClass];
}
- (Class)classForKeyPath:(NSString *)keyPath
{
NSArray *components = [keyPath componentsSeparatedByString:@"."];
Class propertyClass = self.objectClass;
for (NSString *property in components) {
propertyClass = [[RKPropertyInspector sharedInspector] typeForProperty:property ofClass:propertyClass];
if (! propertyClass) break;
}
return propertyClass;
}
#pragma mark - Date and Time
- (NSFormatter *)preferredDateFormatter