Renamed Polymorphic mapping to dynamic mapping after consulting with the community. Dropped abstract superclass in favor of a RKObjectMappingDefinition protocol. Caught missing cases with dynamic object mapping + targetObject. Updated docs and method signatures to reflect the updates.

This commit is contained in:
Blake Watters
2011-07-31 19:37:42 -04:00
parent eab35ef3f7
commit 4e03ba7bef
27 changed files with 315 additions and 268 deletions

View File

@@ -7,7 +7,7 @@
//
#import <Foundation/Foundation.h>
#import "RKObjectAbstractMapping.h"
#import "RKObjectMappingDefinition.h"
#import "RKObjectAttributeMapping.h"
#import "RKObjectRelationshipMapping.h"
@@ -31,7 +31,7 @@ relationship. Relationships are processed using an object mapping as well.
Instances of RKObjectMapping are used to configure RKObjectMappingOperation instances, which actually
perform the mapping work. Both object loading and serialization are defined in terms of object mappings.
*/
@interface RKObjectMapping : RKObjectAbstractMapping {
@interface RKObjectMapping : NSObject <RKObjectMappingDefinition> {
Class _objectClass;
NSMutableArray* _mappings;
NSMutableArray* _dateFormatStrings;
@@ -248,9 +248,9 @@ relationship. Relationships are processed using an object mapping as well.
@param relationshipKey A key-value coding key corresponding to a value in the mappable source object and a property
on the destination class that have the same name.
@param objectOrPolymorphicMapping An RKObjectMapping or RKObjectPolymorphic mapping to apply when mapping the relationship
@param objectOrDynamicMapping An RKObjectMapping or RKObjectDynamic mapping to apply when mapping the relationship
*/
- (void)mapRelationship:(NSString*)relationshipKey withMapping:(RKObjectAbstractMapping*)objectOrPolymorphicMapping;
- (void)mapRelationship:(NSString*)relationshipKey withMapping:(id<RKObjectMappingDefinition>)objectOrDynamicMapping;
/**
Syntactic sugar to improve readability when defining a relationship mapping. Implies that the mapping
@@ -258,7 +258,7 @@ relationship. Relationships are processed using an object mapping as well.
@see mapRelationship:withObjectMapping:
*/
- (void)hasMany:(NSString*)keyPath withMapping:(RKObjectAbstractMapping*)objectOrPolymorphicMapping;
- (void)hasMany:(NSString*)keyPath withMapping:(id<RKObjectMappingDefinition>)objectOrDynamicMapping;
/**
Syntactic sugar to improve readability when defining a relationship mapping. Implies that the mapping
@@ -266,7 +266,7 @@ relationship. Relationships are processed using an object mapping as well.
@see mapRelationship:withObjectMapping:
*/
- (void)hasOne:(NSString*)keyPath withMapping:(RKObjectAbstractMapping*)objectOrPolymorphicMapping;
- (void)hasOne:(NSString*)keyPath withMapping:(id<RKObjectMappingDefinition>)objectOrDynamicMapping;
/**
Instantiate and add an RKObjectAttributeMapping instance targeting a keyPath within the mappable
@@ -307,7 +307,7 @@ relationship. Relationships are processed using an object mapping as well.
@param objectMapping An object mapping to use when processing the nested objects
@see RKObjectRelationshipMapping
*/
- (void)mapKeyPath:(NSString *)sourceKeyPath toRelationship:(NSString*)destinationRelationship withMapping:(RKObjectAbstractMapping *)objectOrPolymorphicMapping;
- (void)mapKeyPath:(NSString *)sourceKeyPath toRelationship:(NSString*)destinationRelationship withMapping:(id<RKObjectMappingDefinition>)objectOrDynamicMapping;
/**
Instantiate and add an RKObjectRelationshipMapping instance targeting a keyPath within the mappable
@@ -322,7 +322,7 @@ relationship. Relationships are processed using an object mapping as well.
@see mapKeyPath:toRelationship:withObjectMapping:
*/
- (void)mapKeyPath:(NSString *)relationshipKeyPath toRelationship:(NSString*)keyPath withMapping:(RKObjectAbstractMapping *)objectOrPolymorphicMapping serialize:(BOOL)serialize;
- (void)mapKeyPath:(NSString *)relationshipKeyPath toRelationship:(NSString*)keyPath withMapping:(id<RKObjectMappingDefinition>)objectOrDynamicMapping serialize:(BOOL)serialize;
/**
Quickly define a group of attribute mappings using alternating keyPath and attribute names. You must provide