mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-01-12 22:51:50 +08:00
Cleaned up all warnings. Normalized method names. General cleanup of model mapping API. Shit is getting slick and maintainable!
This commit is contained in:
@@ -55,7 +55,7 @@ static NSString *urlEncode(id object) {
|
||||
va_start(args, firstKey);
|
||||
NSMutableArray* keys = [NSMutableArray array];
|
||||
NSMutableArray* values = [NSMutableArray array];
|
||||
for (id *key = firstKey; key != nil; key = va_arg(args, id)) {
|
||||
for (id key = firstKey; key != nil; key = va_arg(args, id)) {
|
||||
id value = va_arg(args, id);
|
||||
[keys addObject:key];
|
||||
[values addObject:value];
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
@implementation RKMappingFormatJSONParser
|
||||
|
||||
- (NSDictionary*)dictionaryFromString:(NSString*)string {
|
||||
- (NSDictionary*)objectFromString:(NSString*)string {
|
||||
return [[[[SBJSON alloc] init] autorelease] objectWithString:string];
|
||||
}
|
||||
|
||||
|
||||
@@ -11,14 +11,139 @@
|
||||
#import "RKModelMapper.h"
|
||||
#import "RKMappingFormatJSONParser.h"
|
||||
|
||||
// TODO: Factor me out...
|
||||
#define kRailsToXMLDateTimeFormatterString @"yyyy-MM-dd'T'HH:mm:ss'Z'" // 2009-08-08T17:23:59Z
|
||||
#define kRailsToXMLDateFormatterString @"MM/dd/yyyy"
|
||||
|
||||
@interface RKModelMapper (Private)
|
||||
|
||||
- (void)updateModel:(id)model fromElements:(NSDictionary*)elements;
|
||||
|
||||
- (Class)typeClassForProperty:(NSString*)property ofClass:(Class)class;
|
||||
- (NSDictionary*)elementToPropertyMappingsForModel:(id)model;
|
||||
|
||||
- (id)findOrCreateInstanceOfModelClass:(Class)class fromElements:(NSDictionary*)elements;
|
||||
- (id)createOrUpdateInstanceOfModelClass:(Class)class fromElements:(NSDictionary*)elements;
|
||||
|
||||
- (void)updateModel:(id)model ifNewPropertyValue:(id)propertyValue forPropertyNamed:(NSString*)propertyName; // Rename!
|
||||
- (void)setPropertiesOfModel:(id)model fromElements:(NSDictionary*)elements;
|
||||
- (void)setRelationshipsOfModel:(id)object fromElements:(NSDictionary*)elements;
|
||||
- (void)updateModel:(id)model fromElements:(NSDictionary*)elements;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RKModelMapper
|
||||
|
||||
@synthesize format = _format;
|
||||
@synthesize parser = _parser;
|
||||
|
||||
// private
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// public
|
||||
|
||||
- (id)findOrCreateMappableInstanceOf:(Class)class fromElements:(NSDictionary*)elements {
|
||||
- (id)init {
|
||||
if (self = [super init]) {
|
||||
_elementToClassMappings = [[NSMutableDictionary alloc] init];
|
||||
_format = RKMappingFormatXML;
|
||||
_inspector = [[RKObjectPropertyInspector alloc] init];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[_elementToClassMappings release];
|
||||
[_parser release];
|
||||
[_inspector release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)registerModel:(Class)aClass forElementNamed:(NSString*)elementName {
|
||||
[_elementToClassMappings setObject:aClass forKey:elementName];
|
||||
}
|
||||
|
||||
- (void)setFormat:(RKMappingFormat)format {
|
||||
_format = format;
|
||||
if (nil == self.parser) {
|
||||
if (RKMappingFormatJSON == _format) {
|
||||
self.parser = [[[RKMappingFormatJSONParser alloc] init] autorelease];
|
||||
} else if (RKMappingFormatXML == _format) {
|
||||
// TODO: Implement in the future...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Mapping from objects
|
||||
|
||||
- (void)mapModel:(id)model fromDictionary:(NSDictionary*)dictionary {
|
||||
Class class = [model class];
|
||||
NSString* elementName = [[_elementToClassMappings allKeysForObject:class] objectAtIndex:0];
|
||||
NSDictionary* elements = [dictionary objectForKey:elementName];
|
||||
|
||||
[self updateModel:model fromElements:elements];
|
||||
}
|
||||
|
||||
- (id)mapModelFromDictionary:(NSDictionary*)dictionary {
|
||||
NSString* elementName = [[dictionary allKeys] objectAtIndex:0];
|
||||
Class class = [_elementToClassMappings objectForKey:elementName];
|
||||
NSDictionary* elements = [dictionary objectForKey:elementName];
|
||||
|
||||
id model = [self findOrCreateInstanceOfModelClass:class fromElements:elements];
|
||||
[self updateModel:model fromElements:elements];
|
||||
return model;
|
||||
}
|
||||
|
||||
- (NSArray*)mapModelsFromArrayOfDictionaries:(NSArray*)array {
|
||||
NSMutableArray* objects = [NSMutableArray array];
|
||||
for (NSDictionary* dictionary in array) {
|
||||
NSString* elementName = [[dictionary allKeys] objectAtIndex:0];
|
||||
Class class = [_elementToClassMappings objectForKey:elementName];
|
||||
NSDictionary* elements = [dictionary objectForKey:elementName];
|
||||
id object = [self createOrUpdateInstanceOfModelClass:class fromElements:elements];
|
||||
[objects addObject:object];
|
||||
}
|
||||
|
||||
return (NSArray*)objects;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Mapping from a string
|
||||
|
||||
- (id)mapFromString:(NSString*)string {
|
||||
id object = [_parser objectFromString:string];
|
||||
if ([object isKindOfClass:[NSDictionary class]]) {
|
||||
return [self mapModelFromDictionary:(NSDictionary*)object];
|
||||
} else if ([object isKindOfClass:[NSArray class]]) {
|
||||
return [self mapModelsFromArrayOfDictionaries:(NSArray*)object];
|
||||
} else {
|
||||
// TODO: Throw error here!
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)mapModel:(id)model fromString:(NSString*)string {
|
||||
id object = [_parser objectFromString:string];
|
||||
if ([object isKindOfClass:[NSDictionary class]]) {
|
||||
[self mapModel:object fromDictionary:object];
|
||||
} else {
|
||||
// TODO: Handle error here!
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Utility Methods
|
||||
|
||||
- (Class)typeClassForProperty:(NSString*)property ofClass:(Class)class {
|
||||
return [[_inspector propertyNamesAndTypesForClass:class] objectForKey:property];
|
||||
}
|
||||
|
||||
- (NSDictionary*)elementToPropertyMappingsForModel:(id)model {
|
||||
return [[model class] elementToPropertyMappings];
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Persistent Instance Finders
|
||||
|
||||
- (id)findOrCreateInstanceOfModelClass:(Class)class fromElements:(NSDictionary*)elements {
|
||||
id object = nil;
|
||||
if ([class respondsToSelector:@selector(findByPrimaryKey:)]) {
|
||||
NSString* primaryKeyElement = [class primaryKeyElement];
|
||||
@@ -38,74 +163,18 @@
|
||||
return object;
|
||||
}
|
||||
|
||||
- (id)createOrUpdateInstanceOf:(Class)class withPropertiesForElements:(NSDictionary*)elements {
|
||||
id mappedObject = [self findOrCreateMappableInstanceOf:class fromElements:elements];
|
||||
[self setPropertiesOfObject:mappedObject fromElements:elements];
|
||||
[self setRelationshipsOfObject:mappedObject fromElements:elements];
|
||||
|
||||
return mappedObject;
|
||||
- (id)createOrUpdateInstanceOfModelClass:(Class)class fromElements:(NSDictionary*)elements {
|
||||
id model = [self findOrCreateInstanceOfModelClass:class fromElements:elements];
|
||||
[self updateModel:model fromElements:elements];
|
||||
return model;
|
||||
}
|
||||
|
||||
- (NSDictionary*)elementToPropertyMappingsForObject:(id<RKModelMappable>)object {
|
||||
return [[object class] elementToPropertyMappings];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Property Type Methods
|
||||
// TODO: Move these out into another class???
|
||||
|
||||
- (NSString*)propertyTypeFromAttributeString:(NSString*)attributeString {
|
||||
NSString *type = [NSString string];
|
||||
NSScanner *typeScanner = [NSScanner scannerWithString:attributeString];
|
||||
[typeScanner scanUpToCharactersFromSet:[NSCharacterSet characterSetWithCharactersInString:@"@"] intoString:NULL];
|
||||
|
||||
// we are not dealing with an object
|
||||
if([typeScanner isAtEnd]) {
|
||||
return @"NULL";
|
||||
}
|
||||
[typeScanner scanCharactersFromSet:[NSCharacterSet characterSetWithCharactersInString:@"\"@"] intoString:NULL];
|
||||
// this gets the actual object type
|
||||
[typeScanner scanUpToCharactersFromSet:[NSCharacterSet characterSetWithCharactersInString:@"\""] intoString:&type];
|
||||
return type;
|
||||
}
|
||||
|
||||
- (NSDictionary *)propertyNamesAndTypesForClass:(Class)class {
|
||||
NSMutableDictionary *propertyNames = [NSMutableDictionary dictionary];
|
||||
|
||||
//include superclass properties
|
||||
Class currentClass = class;
|
||||
while (currentClass != nil) {
|
||||
// Get the raw list of properties
|
||||
unsigned int outCount;
|
||||
objc_property_t *propList = class_copyPropertyList(currentClass, &outCount);
|
||||
|
||||
// Collect the property names
|
||||
int i;
|
||||
NSString *propName;
|
||||
for (i = 0; i < outCount; i++) {
|
||||
// TODO: Add support for custom getter and setter methods
|
||||
// property_getAttributes() returns everything we need to implement this...
|
||||
// See: http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtPropertyIntrospection.html#//apple_ref/doc/uid/TP40008048-CH101-SW5
|
||||
objc_property_t * prop = propList + i;
|
||||
NSString *type = [NSString stringWithCString:property_getAttributes(*prop) encoding:NSUTF8StringEncoding];
|
||||
propName = [NSString stringWithCString:property_getName(*prop) encoding:NSUTF8StringEncoding];
|
||||
if (![propName isEqualToString:@"_mapkit_hasPanoramaID"]) {
|
||||
[propertyNames setObject:[self propertyTypeFromAttributeString:type] forKey:propName];
|
||||
}
|
||||
}
|
||||
|
||||
free(propList);
|
||||
currentClass = [currentClass superclass];
|
||||
}
|
||||
return propertyNames;
|
||||
}
|
||||
|
||||
- (NSString*)typeNameForProperty:(NSString*)property ofClass:(Class)class {
|
||||
return [[self propertyNamesAndTypesForClass:class] objectForKey:property];
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Property & Relationship Manipulation
|
||||
|
||||
// TODO: Clean up the method below...
|
||||
- (void)updateObject:(id)model ifNewPropertyValue:(id)propertyValue forPropertyNamed:(NSString*)propertyName {
|
||||
// Better name?
|
||||
- (void)updateModel:(id)model ifNewPropertyValue:(id)propertyValue forPropertyNamed:(NSString*)propertyName {
|
||||
id currentValue = [model valueForKey:propertyName];
|
||||
if (nil == currentValue && nil == propertyValue) {
|
||||
// Don't set the property, both are nil
|
||||
@@ -142,12 +211,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setPropertiesOfObject:(id)object fromElements:(NSDictionary*)elements {
|
||||
NSDictionary* elementToPropertyMappings = [self elementToPropertyMappingsForObject:object];
|
||||
- (void)setPropertiesOfModel:(id)model fromElements:(NSDictionary*)elements {
|
||||
NSDictionary* elementToPropertyMappings = [self elementToPropertyMappingsForModel:model];
|
||||
for (NSString* elementKeyPath in elementToPropertyMappings) {
|
||||
NSString* propertyName = [elementToPropertyMappings objectForKey:elementKeyPath];
|
||||
// NSString* propertyType = [self typeNameForProperty:propertyName ofClass:[object class]];
|
||||
// NSLog(@"propertyType is %@", propertyType);
|
||||
Class class = [self typeClassForProperty:propertyName ofClass:[model class]];
|
||||
id elementValue = nil;
|
||||
|
||||
@try {
|
||||
@@ -158,13 +226,29 @@
|
||||
NSLog(@"Encountered exception %@ when asking %@ for valueForKeyPath %@", e, elements, elementKeyPath);
|
||||
}
|
||||
|
||||
// TODO: Need to parse date's and shit here...
|
||||
id propertyValue = elementValue;
|
||||
[self updateObject:object ifNewPropertyValue:propertyValue forPropertyNamed:propertyName];
|
||||
id propertyValue = elementValue;
|
||||
if (nil != elementValue) { // kCFNull??
|
||||
if ([class isEqual:[NSDate class]]) {
|
||||
// TODO: This date parsing needs to be factored out...
|
||||
NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
|
||||
// Times coming back are in utc. we should convert them to the local timezone
|
||||
// TODO: Note that this currently only handles times and not stand-alone date's! needs to be cleaned up!
|
||||
[formatter setTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0]];
|
||||
[formatter setDateFormat:kRailsToXMLDateTimeFormatterString];
|
||||
propertyValue = [formatter dateFromString:propertyValue];
|
||||
if (nil == propertyValue) {
|
||||
[formatter setDateFormat:kRailsToXMLDateFormatterString];
|
||||
propertyValue = [formatter dateFromString:propertyValue];
|
||||
}
|
||||
[formatter release];
|
||||
}
|
||||
}
|
||||
|
||||
[self updateModel:model ifNewPropertyValue:propertyValue forPropertyNamed:propertyName];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setRelationshipsOfObject:(id)object fromElements:(NSDictionary*)elements {
|
||||
- (void)setRelationshipsOfModel:(id)object fromElements:(NSDictionary*)elements {
|
||||
NSDictionary* elementToRelationshipMappings = [[object class] elementToRelationshipMappings];
|
||||
for (NSString* elementKeyPath in elementToRelationshipMappings) {
|
||||
NSString* propertyName = [elementToRelationshipMappings objectForKey:elementKeyPath];
|
||||
@@ -176,76 +260,33 @@
|
||||
Class class = [_elementToClassMappings objectForKey:[componentsOfKeyPath objectAtIndex:[componentsOfKeyPath count] - 1]];
|
||||
NSMutableArray* children = [NSMutableArray arrayWithCapacity:[relationshipElements count]];
|
||||
for (NSDictionary* childElements in relationshipElements) {
|
||||
id child = [self createOrUpdateInstanceOf:class withPropertiesForElements:childElements];
|
||||
id child = [self createOrUpdateInstanceOfModelClass:class fromElements:childElements];
|
||||
[children addObject:child];
|
||||
}
|
||||
|
||||
[object setValue:children forKey:propertyName];
|
||||
} else {
|
||||
Class class = [_elementToClassMappings objectForKey:elementKeyPath];
|
||||
id child = [self createOrUpdateInstanceOf:class withPropertiesForElements:relationshipElements];
|
||||
id child = [self createOrUpdateInstanceOfModelClass:class fromElements:relationshipElements];
|
||||
[object setValue:child forKey:propertyName];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// public
|
||||
|
||||
- (id)init {
|
||||
if (self = [super init]) {
|
||||
_elementToClassMappings = [[NSMutableDictionary alloc] init];
|
||||
_format = RKMappingFormatXML;
|
||||
}
|
||||
return self;
|
||||
- (void)updateModel:(id)model fromElements:(NSDictionary*)elements {
|
||||
[self setPropertiesOfModel:model fromElements:elements];
|
||||
[self setRelationshipsOfModel:model fromElements:elements];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[_elementToClassMappings release];
|
||||
[_parser release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)registerModel:(Class)aClass forElementNamed:(NSString*)elementName {
|
||||
[_elementToClassMappings setObject:aClass forKey:elementName];
|
||||
}
|
||||
|
||||
- (void)setFormat:(RKMappingFormat)format {
|
||||
_format = format;
|
||||
if (nil == self.parser) {
|
||||
if (RKMappingFormatJSON == _format) {
|
||||
self.parser = [[[RKMappingFormatJSONParser alloc] init] autorelease];
|
||||
} else if (RKMappingFormatXML == _format) {
|
||||
// TODO: Implement in the future...
|
||||
}
|
||||
}
|
||||
}
|
||||
///////////////////////////////////////////////
|
||||
// deprecated method names -- to be replaced
|
||||
|
||||
- (id)buildModelFromString:(NSString*)string {
|
||||
NSDictionary* dictionary = [_parser dictionaryFromString:string];
|
||||
NSString* elementName = [[dictionary allKeys] objectAtIndex:0];
|
||||
Class class = [_elementToClassMappings objectForKey:elementName];
|
||||
NSDictionary* elements = [dictionary objectForKey:elementName];
|
||||
return [self createOrUpdateInstanceOf:class withPropertiesForElements:elements];
|
||||
return [self mapFromString:string];
|
||||
}
|
||||
|
||||
- (NSArray*)buildModelsFromString:(NSString*)string {
|
||||
NSDictionary* collectionDictionary = [_parser dictionaryFromString:string];
|
||||
NSMutableArray* objects = [NSMutableArray array];
|
||||
NSString* collectionKey = [[collectionDictionary allKeys] objectAtIndex:0];
|
||||
for (NSDictionary* dictionary in [collectionDictionary objectForKey:collectionKey]) {
|
||||
NSString* elementName = [[dictionary allKeys] objectAtIndex:0];
|
||||
Class class = [_elementToClassMappings objectForKey:elementName];
|
||||
NSDictionary* elements = [dictionary objectForKey:elementName];
|
||||
id object = [self createOrUpdateInstanceOf:class withPropertiesForElements:elements];
|
||||
[objects addObject:object];
|
||||
}
|
||||
|
||||
return (NSArray*)objects;
|
||||
}
|
||||
|
||||
- (void)mapModel:(id)model fromString:(NSString*)string {
|
||||
// TODO
|
||||
return [self mapFromString:string];
|
||||
}
|
||||
|
||||
- (void)setAttributes:(id)object fromXML:(Element*)XML {
|
||||
|
||||
21
Code/RKObjectPropertyInspector.h
Normal file
21
Code/RKObjectPropertyInspector.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// RKObjectPropertyInspector.h
|
||||
// RestKit
|
||||
//
|
||||
// Created by Blake Watters on 3/4/10.
|
||||
// Copyright 2010 Two Toasters. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface RKObjectPropertyInspector : NSObject {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a dictionary of names and types for the properties of a given class
|
||||
*/
|
||||
- (NSDictionary *)propertyNamesAndTypesForClass:(Class)class;
|
||||
|
||||
@end
|
||||
64
Code/RKObjectPropertyInspector.m
Normal file
64
Code/RKObjectPropertyInspector.m
Normal file
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// RKObjectPropertyInspector.m
|
||||
// RestKit
|
||||
//
|
||||
// Created by Blake Watters on 3/4/10.
|
||||
// Copyright 2010 Two Toasters. All rights reserved.
|
||||
//
|
||||
|
||||
#import <objc/message.h>
|
||||
|
||||
#import "RKObjectPropertyInspector.h"
|
||||
|
||||
@implementation RKObjectPropertyInspector
|
||||
|
||||
- (NSString*)propertyTypeFromAttributeString:(NSString*)attributeString {
|
||||
NSString *type = [NSString string];
|
||||
NSScanner *typeScanner = [NSScanner scannerWithString:attributeString];
|
||||
[typeScanner scanUpToCharactersFromSet:[NSCharacterSet characterSetWithCharactersInString:@"@"] intoString:NULL];
|
||||
|
||||
// we are not dealing with an object
|
||||
if([typeScanner isAtEnd]) {
|
||||
return @"NULL";
|
||||
}
|
||||
[typeScanner scanCharactersFromSet:[NSCharacterSet characterSetWithCharactersInString:@"\"@"] intoString:NULL];
|
||||
// this gets the actual object type
|
||||
[typeScanner scanUpToCharactersFromSet:[NSCharacterSet characterSetWithCharactersInString:@"\""] intoString:&type];
|
||||
return type;
|
||||
}
|
||||
|
||||
- (NSDictionary *)propertyNamesAndTypesForClass:(Class)class {
|
||||
NSMutableDictionary *propertyNames = [NSMutableDictionary dictionary];
|
||||
|
||||
//include superclass properties
|
||||
Class currentClass = class;
|
||||
while (currentClass != nil) {
|
||||
// Get the raw list of properties
|
||||
unsigned int outCount;
|
||||
objc_property_t *propList = class_copyPropertyList(currentClass, &outCount);
|
||||
|
||||
// Collect the property names
|
||||
int i;
|
||||
NSString *propName;
|
||||
for (i = 0; i < outCount; i++) {
|
||||
// TODO: Add support for custom getter and setter methods
|
||||
// property_getAttributes() returns everything we need to implement this...
|
||||
// See: http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtPropertyIntrospection.html#//apple_ref/doc/uid/TP40008048-CH101-SW5
|
||||
objc_property_t* prop = propList + i;
|
||||
NSString* attributeString = [NSString stringWithCString:property_getAttributes(*prop) encoding:NSUTF8StringEncoding];
|
||||
propName = [NSString stringWithCString:property_getName(*prop) encoding:NSUTF8StringEncoding];
|
||||
|
||||
if (![propName isEqualToString:@"_mapkit_hasPanoramaID"]) {
|
||||
const char* className = [[self propertyTypeFromAttributeString:attributeString] cStringUsingEncoding:NSUTF8StringEncoding];
|
||||
Class class = objc_getClass(className);
|
||||
[propertyNames setObject:class forKey:propName];
|
||||
}
|
||||
}
|
||||
|
||||
free(propList);
|
||||
currentClass = [currentClass superclass];
|
||||
}
|
||||
return propertyNames;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "RKModelMappableProtocol.h"
|
||||
#import "RKObjectPropertyInspector.h"
|
||||
|
||||
// TODO: The below goes away
|
||||
#import "ElementParser.h"
|
||||
@@ -20,9 +21,11 @@
|
||||
@protocol RKMappingFormatParser
|
||||
|
||||
/**
|
||||
* Return a dictionary from a string of encoded data (i.e. XML or JSON)
|
||||
* Return a key-value coding compliant representation of a payload.
|
||||
* Object attributes are encoded as a dictionary and collections
|
||||
* of objects are returned as arrays.
|
||||
*/
|
||||
- (NSDictionary*)dictionaryFromString:(NSString*)string;
|
||||
- (id)objectFromString:(NSString*)string;
|
||||
|
||||
@end
|
||||
|
||||
@@ -30,6 +33,7 @@
|
||||
NSMutableDictionary* _elementToClassMappings;
|
||||
RKMappingFormat _format;
|
||||
NSObject<RKMappingFormatParser>* _parser;
|
||||
RKObjectPropertyInspector* _inspector;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
252F4FA9114046C9003C6F42 /* RKMappingFormatJSONParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 252F4FA7114046C9003C6F42 /* RKMappingFormatJSONParser.h */; };
|
||||
252F4FAA114046C9003C6F42 /* RKMappingFormatJSONParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 252F4FA8114046C9003C6F42 /* RKMappingFormatJSONParser.m */; };
|
||||
252F4FAB114046C9003C6F42 /* RKMappingFormatJSONParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 252F4FA8114046C9003C6F42 /* RKMappingFormatJSONParser.m */; };
|
||||
252F558B1140B93A003C6F42 /* RKObjectPropertyInspector.m in Sources */ = {isa = PBXBuildFile; fileRef = 252F558A1140B93A003C6F42 /* RKObjectPropertyInspector.m */; };
|
||||
252F558C1140B93A003C6F42 /* RKObjectPropertyInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 252F55891140B93A003C6F42 /* RKObjectPropertyInspector.h */; };
|
||||
252F558D1140B93A003C6F42 /* RKObjectPropertyInspector.m in Sources */ = {isa = PBXBuildFile; fileRef = 252F558A1140B93A003C6F42 /* RKObjectPropertyInspector.m */; };
|
||||
253BBE961076AB1C00C804B2 /* NSString+InflectionSupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 253BBE941076AB1C00C804B2 /* NSString+InflectionSupport.h */; };
|
||||
253BBE971076AB1C00C804B2 /* NSString+InflectionSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 253BBE951076AB1C00C804B2 /* NSString+InflectionSupport.m */; };
|
||||
255DE05A10FF9DA500A85891 /* RKModelManagerSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 255DE05910FF9DA500A85891 /* RKModelManagerSpec.m */; };
|
||||
@@ -60,8 +63,6 @@
|
||||
2580B0C7102E1EBC00832D07 /* libElementParser.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F4E18DB102DD31E00320118 /* libElementParser.a */; };
|
||||
25FCDDDB1035BC85005418A7 /* RKManagedModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 25FCDDD91035BC85005418A7 /* RKManagedModel.h */; };
|
||||
25FCDDDC1035BC85005418A7 /* RKManagedModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 25FCDDDA1035BC85005418A7 /* RKManagedModel.m */; };
|
||||
25FCDDE01035C201005418A7 /* RKModelMapper_Old.h in Headers */ = {isa = PBXBuildFile; fileRef = 25FCDDDE1035C201005418A7 /* RKModelMapper_Old.h */; };
|
||||
25FCDDE11035C201005418A7 /* RKModelMapper_Old.m in Sources */ = {isa = PBXBuildFile; fileRef = 25FCDDDF1035C201005418A7 /* RKModelMapper_Old.m */; };
|
||||
25FCDE9C1035E901005418A7 /* RKModelMappableProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = 25FCDE9B1035E901005418A7 /* RKModelMappableProtocol.h */; };
|
||||
3F0150FF103B148300BE3E24 /* RKModelMapper_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F0150FE103B148300BE3E24 /* RKModelMapper_Private.h */; };
|
||||
3F032A7910FFB89100F35142 /* RKCat.m in Sources */ = {isa = PBXBuildFile; fileRef = 3F032A7810FFB89100F35142 /* RKCat.m */; };
|
||||
@@ -221,6 +222,8 @@
|
||||
252F4F9F1140433D003C6F42 /* RKModelMapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RKModelMapper.m; path = Code/RKModelMapper.m; sourceTree = "<group>"; };
|
||||
252F4FA7114046C9003C6F42 /* RKMappingFormatJSONParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RKMappingFormatJSONParser.h; path = Code/RKMappingFormatJSONParser.h; sourceTree = "<group>"; };
|
||||
252F4FA8114046C9003C6F42 /* RKMappingFormatJSONParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RKMappingFormatJSONParser.m; path = Code/RKMappingFormatJSONParser.m; sourceTree = "<group>"; };
|
||||
252F55891140B93A003C6F42 /* RKObjectPropertyInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RKObjectPropertyInspector.h; path = Code/RKObjectPropertyInspector.h; sourceTree = "<group>"; };
|
||||
252F558A1140B93A003C6F42 /* RKObjectPropertyInspector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RKObjectPropertyInspector.m; path = Code/RKObjectPropertyInspector.m; sourceTree = "<group>"; };
|
||||
253BBE941076AB1C00C804B2 /* NSString+InflectionSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSString+InflectionSupport.h"; path = "Code/RestKit/NSString+InflectionSupport.h"; sourceTree = "<group>"; };
|
||||
253BBE951076AB1C00C804B2 /* NSString+InflectionSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSString+InflectionSupport.m"; path = "Code/NSString+InflectionSupport.m"; sourceTree = "<group>"; };
|
||||
255DE03010FF9BDF00A85891 /* RKManagedModelSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKManagedModelSpec.m; sourceTree = "<group>"; };
|
||||
@@ -480,6 +483,8 @@
|
||||
252F4F9F1140433D003C6F42 /* RKModelMapper.m */,
|
||||
252F4FA7114046C9003C6F42 /* RKMappingFormatJSONParser.h */,
|
||||
252F4FA8114046C9003C6F42 /* RKMappingFormatJSONParser.m */,
|
||||
252F55891140B93A003C6F42 /* RKObjectPropertyInspector.h */,
|
||||
252F558A1140B93A003C6F42 /* RKObjectPropertyInspector.m */,
|
||||
);
|
||||
name = Modeling;
|
||||
sourceTree = "<group>";
|
||||
@@ -551,7 +556,6 @@
|
||||
3F4E191A102DD42F00320118 /* NSDictionary+RKRequestSerialization.h in Headers */,
|
||||
2580B068102E0F1000832D07 /* RKModelLoader.h in Headers */,
|
||||
25FCDDDB1035BC85005418A7 /* RKManagedModel.h in Headers */,
|
||||
25FCDDE01035C201005418A7 /* RKModelMapper_Old.h in Headers */,
|
||||
25FCDE9C1035E901005418A7 /* RKModelMappableProtocol.h in Headers */,
|
||||
3FBF1D39103614E500E307AC /* RKModelManager.h in Headers */,
|
||||
3F0150FF103B148300BE3E24 /* RKModelMapper_Private.h in Headers */,
|
||||
@@ -561,6 +565,7 @@
|
||||
252F4CC0114021B5003C6F42 /* RKModelSeeder.h in Headers */,
|
||||
252F4FA11140433D003C6F42 /* RKModelMapper.h in Headers */,
|
||||
252F4FA9114046C9003C6F42 /* RKMappingFormatJSONParser.h in Headers */,
|
||||
252F558C1140B93A003C6F42 /* RKObjectPropertyInspector.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -772,6 +777,7 @@
|
||||
252F4F9D11404322003C6F42 /* RKModelLoader.m in Sources */,
|
||||
252F4FA01140433D003C6F42 /* RKModelMapper.m in Sources */,
|
||||
252F4FAB114046C9003C6F42 /* RKMappingFormatJSONParser.m in Sources */,
|
||||
252F558B1140B93A003C6F42 /* RKObjectPropertyInspector.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -789,7 +795,6 @@
|
||||
3F4E191B102DD42F00320118 /* NSDictionary+RKRequestSerialization.m in Sources */,
|
||||
2580B069102E0F1000832D07 /* RKModelLoader.m in Sources */,
|
||||
25FCDDDC1035BC85005418A7 /* RKManagedModel.m in Sources */,
|
||||
25FCDDE11035C201005418A7 /* RKModelMapper_Old.m in Sources */,
|
||||
3FBF1D3A103614E500E307AC /* RKModelManager.m in Sources */,
|
||||
2525EBEC106961DD0069EBED /* RKManagedObjectStore.m in Sources */,
|
||||
2525F9A1106C0FF40069EBED /* RKNotifications.m in Sources */,
|
||||
@@ -797,6 +802,7 @@
|
||||
252F4CC1114021B5003C6F42 /* RKModelSeeder.m in Sources */,
|
||||
252F4FA21140433D003C6F42 /* RKModelMapper.m in Sources */,
|
||||
252F4FAA114046C9003C6F42 /* RKMappingFormatJSONParser.m in Sources */,
|
||||
252F558D1140B93A003C6F42 /* RKObjectPropertyInspector.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user