File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,13 @@ relationship. Relationships are processed using an object mapping as well.
5959 */
6060@property (nonatomic , assign ) Class objectClass;
6161
62+ /* *
63+ The name of the target class the receiver defines a mapping for.
64+
65+ @see objectClass
66+ */
67+ @property (nonatomic , copy ) NSString *objectClassName;
68+
6269/* *
6370 The aggregate collection of attribute and relationship mappings within this object mapping
6471 */
@@ -146,6 +153,14 @@ relationship. Relationships are processed using an object mapping as well.
146153 */
147154+ (id )mappingForClass : (Class )objectClass ;
148155
156+ /* *
157+ Creates and returns an object mapping for the class with the given name
158+
159+ @param objectClassName The name of the class the mapping is for.
160+ @return A new object mapping with for the class with given name.
161+ */
162+ + (id )mappingForClassWithName : (NSString *)objectClassName ;
163+
149164/* *
150165 Returns an object mapping useful for configuring a serialization mapping. The object
151166 class is configured as NSMutableDictionary
Original file line number Diff line number Diff line change @@ -45,6 +45,10 @@ + (id)mappingForClass:(Class)objectClass {
4545 return [mapping autorelease ];
4646}
4747
48+ + (id )mappingForClassWithName : (NSString *)objectClassName {
49+ return [self mappingForClass: NSClassFromString (objectClassName)];
50+ }
51+
4852+ (id )serializationMapping {
4953 return [self mappingForClass: [NSMutableDictionary class ]];
5054}
@@ -120,6 +124,14 @@ - (void)dealloc {
120124 [super dealloc ];
121125}
122126
127+ - (NSString *)objectClassName {
128+ return NSStringFromClass (self.objectClass );
129+ }
130+
131+ - (void )setObjectClassName : (NSString *)objectClassName {
132+ self.objectClass = NSClassFromString (objectClassName);
133+ }
134+
123135- (NSArray *)mappedKeyPaths {
124136 return [_mappings valueForKey: @" destinationKeyPath" ];
125137}
You can’t perform that action at this time.
0 commit comments