mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Added support for polymorphic object mapping (Github #105, #244). This enables you to dynamically map objects to different destination classes or using different mapping strategies via configuration or callbacks. See Docs/Object Mapping.md for details.
Other changes include: * Eliminated the RKObjectFactory protocol and implementations. Object mapping instances themselves are now responsible for instantiating target objects for mapping. * Introduced RKObjectAbstractMapping superclass for RKObjectMapping and RKObjectPolymorphicMapping. * Updated example applications to use block object loaders (RKTwitter and RKTwitterCoreData) * Refactored method signatures of RKObjectMapper, RKObjectMapping, and RKObjectMappingProvider to reflect the existence of abstract mapping types. This was necessary to make polymorphic mappings integrate cleanly. * Fixed overlap in RestKit error domains between network and object mapping. fixes #208
This commit is contained in:
@@ -101,7 +101,7 @@ static NSString* const kDBAccessTokenHTTPHeaderField = @"X-USER-ACCESS-TOKEN";
|
||||
* primary key lookup with the value in 'userID' property. This is the declarative
|
||||
* equivalent of doing self.user = [DBUser objectWithPrimaryKeyValue:self.userID];
|
||||
*/
|
||||
[topicMapping mapRelationship:@"user" withObjectMapping:userMapping];
|
||||
[topicMapping mapRelationship:@"user" withMapping:userMapping];
|
||||
|
||||
RKManagedObjectMapping* postMapping = [RKManagedObjectMapping mappingForClass:[DBPost class]];
|
||||
postMapping.primaryKeyAttribute = @"postID";
|
||||
@@ -118,7 +118,7 @@ static NSString* const kDBAccessTokenHTTPHeaderField = @"X-USER-ACCESS-TOKEN";
|
||||
@"attachment_updated_at", @"attachmentUpdatedAt",
|
||||
@"body", @"body",
|
||||
nil];
|
||||
[postMapping mapRelationship:@"user" withObjectMapping:userMapping];
|
||||
[postMapping mapRelationship:@"user" withMapping:userMapping];
|
||||
|
||||
// Register the mappings with the mapping provider. Use of registerMapping:withRootKeyPath:
|
||||
// configures the mapping provider with both object and serialization mappings for the specified
|
||||
|
||||
@@ -86,6 +86,13 @@
|
||||
remoteGlobalIDString = 25BD43BD1340315800DBACDD;
|
||||
remoteInfo = "RestKitXMLParser+Libxml";
|
||||
};
|
||||
25FB6D6D13E483DE00F48969 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = A7A2D39412D7822C00683D6F /* RestKit.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 20808DBD13DE8CDC000A156A;
|
||||
remoteInfo = "RestKitJSONParser+NXJSON";
|
||||
};
|
||||
3F2562F812DBA4C800AFD2D1 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = A7A2D39412D7822C00683D6F /* RestKit.xcodeproj */;
|
||||
@@ -1100,6 +1107,7 @@
|
||||
A7A2D3AB12D7822D00683D6F /* libRestKitNetwork.a */,
|
||||
A7A2D3AD12D7822D00683D6F /* libRestKitObjectMapping.a */,
|
||||
A7A2D3AF12D7822D00683D6F /* libRestKitSupport.a */,
|
||||
25FB6D6E13E483DE00F48969 /* libRestKitJSONParser+NXJSON.a */,
|
||||
A7A2D3B112D7822D00683D6F /* libRestKitJSONParserYAJL.a */,
|
||||
A7A2D3B312D7822D00683D6F /* libRestKitJSONParserSBJSON.a */,
|
||||
25825AF41337CEAC00C0E3D2 /* libRestKitJSONParserJSONKit.a */,
|
||||
@@ -1183,6 +1191,14 @@
|
||||
remoteRef = 25A7B1DA13421D28004816AA /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
25FB6D6E13E483DE00F48969 /* libRestKitJSONParser+NXJSON.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
name = "libRestKitJSONParser+NXJSON.a";
|
||||
path = libRestKitJSONParserNXJSON.a;
|
||||
remoteRef = 25FB6D6D13E483DE00F48969 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
A7A2D3AB12D7822D00683D6F /* libRestKitNetwork.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
|
||||
Reference in New Issue
Block a user