From 887b4a474383dfc8b7e9341bbb006324328cfc6a Mon Sep 17 00:00:00 2001 From: Blake Watters Date: Wed, 28 Mar 2012 19:19:55 -0400 Subject: [PATCH] Added support for configuring objectClass using the class name instead of Class object. --- Code/ObjectMapping/RKObjectMapping.h | 15 +++++++++++++++ Code/ObjectMapping/RKObjectMapping.m | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Code/ObjectMapping/RKObjectMapping.h b/Code/ObjectMapping/RKObjectMapping.h index 4bd3f3e0..ae24c276 100644 --- a/Code/ObjectMapping/RKObjectMapping.h +++ b/Code/ObjectMapping/RKObjectMapping.h @@ -59,6 +59,13 @@ relationship. Relationships are processed using an object mapping as well. */ @property (nonatomic, assign) Class objectClass; +/** + The name of the target class the receiver defines a mapping for. + + @see objectClass + */ +@property (nonatomic, copy) NSString *objectClassName; + /** The aggregate collection of attribute and relationship mappings within this object mapping */ @@ -146,6 +153,14 @@ relationship. Relationships are processed using an object mapping as well. */ + (id)mappingForClass:(Class)objectClass; +/** + Creates and returns an object mapping for the class with the given name + + @param objectClassName The name of the class the mapping is for. + @return A new object mapping with for the class with given name. + */ ++ (id)mappingForClassWithName:(NSString *)objectClassName; + /** Returns an object mapping useful for configuring a serialization mapping. The object class is configured as NSMutableDictionary diff --git a/Code/ObjectMapping/RKObjectMapping.m b/Code/ObjectMapping/RKObjectMapping.m index 9290e9a2..aeeb1225 100644 --- a/Code/ObjectMapping/RKObjectMapping.m +++ b/Code/ObjectMapping/RKObjectMapping.m @@ -45,6 +45,10 @@ NSString* const RKObjectMappingNestingAttributeKeyName = @"