Remove the mapping provider in favor of response descriptors

This commit is contained in:
Blake Watters
2012-08-28 16:30:55 -04:00
parent 01fee4c157
commit d08046fc5d
18 changed files with 6 additions and 1370 deletions

View File

@@ -29,7 +29,6 @@
#import "RKFetchRequestManagedObjectCache.h"
#import "RKPropertyInspector+CoreData.h"
#import "RKObjectMappingProvider+CoreData.h"
#import "NSManagedObjectContext+RKAdditions.h"
#import "NSManagedObject+RKAdditions.h"
#import "NSEntityDescription+RKAdditions.h"

View File

@@ -24,7 +24,6 @@
#import "RKManagedObjectImporter.h"
#import "RKObjectMapper.h"
#import "RKObjectMappingProvider+CoreData.h"
#import "RKManagedObjectMappingOperationDataSource.h"
#import "RKInMemoryManagedObjectCache.h"
#import "NSString+RKAdditions.h"
@@ -218,10 +217,8 @@
return NSNotFound;
}
RKObjectMappingProvider *mappingProvider = [[RKObjectMappingProvider new] autorelease];
[mappingProvider setMapping:mapping forKeyPath:keyPath ? keyPath : @""];
RKObjectMapper *mapper = [RKObjectMapper mapperWithObject:parsedData mappingProvider:mappingProvider];
NSDictionary *mappingDictionary = @{ keyPath: mapping };
RKObjectMapper *mapper = [[RKObjectMapper alloc] initWithObject:parsedData mappingsDictionary:mappingDictionary];
mapper.mappingOperationDataSource = self.mappingOperationDataSource;
__block RKMappingResult *mappingResult;
[self.managedObjectContext performBlockAndWait:^{

View File

@@ -1,60 +0,0 @@
//
// RKManagedObjectLoader.h
// RestKit
//
// Created by Blake Watters on 2/13/11.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import "RKObjectLoader.h"
#import "RKManagedObjectStore.h"
#import "RKManagedObjectCaching.h"
/**
A subclass of the object loader that is dispatched when you
are loading Core Data managed objects. This differs from the
transient object loader only by handling the special threading
concerns imposed by Core Data.
*/
@interface RKManagedObjectLoader : RKObjectLoader
/**
The managed object cache to consult for retrieving existing object instances. Passed
to the underlying object mapping operation.
*/
@property (nonatomic, retain) id<RKManagedObjectCaching> managedObjectCache;
/**
The managed object context in which a successful object load will be persisted. The managed
object loader constructs a private child context in which the object mapping operation is
performed. If successful, this context is saved, 'pushing' the object loader results into the
parent context.
*/
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;
/**
A main queue managed object context used to retrieve object mapping results for the main thread. After a mapping
operation has completed, the receiver will serialize the managed objects from the mapping result to NSManagedObjectID's,
then jump to the main thread and fetch the managed objects from the mainQueueManagedObjectContext and call back the delegate
with the results of the object loader.
*/
@property (nonatomic, retain) NSManagedObjectContext *mainQueueManagedObjectContext;
@end
@interface RKManagedObjectLoader (Deprecations)
+ (id)loaderWithURL:(RKURL *)URL mappingProvider:(RKObjectMappingProvider *)mappingProvider objectStore:(RKManagedObjectStore *)objectStore DEPRECATED_ATTRIBUTE;
- (id)initWithURL:(RKURL *)URL mappingProvider:(RKObjectMappingProvider *)mappingProvider objectStore:(RKManagedObjectStore *)objectStore DEPRECATED_ATTRIBUTE;
@end

View File

@@ -1,327 +0,0 @@
//
// RKManagedObjectLoader.m
// RestKit
//
// Created by Blake Watters on 2/13/11.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import "RKObjectManager.h"
#import "RKManagedObjectLoader.h"
#import "RKURL.h"
#import "RKObjectMapper.h"
#import "RKManagedObjectThreadSafeInvocation.h"
#import "RKObjectLoader_Internals.h"
#import "RKRequest_Internals.h"
#import "RKObjectMappingProvider+CoreData.h"
#import "RKLog.h"
#import "RKManagedObjectMappingOperationDataSource.h"
#import "NSManagedObjectContext+RKAdditions.h"
// Set Logging Component
#undef RKLogComponent
#define RKLogComponent lcl_cRestKitCoreData
@interface RKManagedObjectLoader ()
@property (nonatomic, retain) NSManagedObjectID *targetObjectID;
@property (nonatomic, retain) NSMutableDictionary *managedObjectsByKeyPath;
@property (nonatomic, retain) NSManagedObjectContext *privateContext;
@end
@implementation RKManagedObjectLoader
@synthesize mainQueueManagedObjectContext = _mainQueueManagedObjectContext;
@synthesize managedObjectContext = _parentManagedObjectContext;
@synthesize managedObjectCache = _managedObjectCache;
@synthesize privateContext = _privateContext;
@synthesize targetObjectID = _targetObjectID;
@synthesize managedObjectsByKeyPath = _managedObjectsByKeyPath;
- (id)initWithURL:(RKURL *)URL mappingProvider:(RKObjectMappingProvider *)mappingProvider
{
self = [super initWithURL:URL mappingProvider:mappingProvider];
if (self) {
self.managedObjectsByKeyPath = [NSMutableDictionary dictionary];
[self addObserver:self forKeyPath:@"managedObjectContext" options:0 context:nil];
[self addObserver:self forKeyPath:@"targetObject" options:0 context:nil];
[self addObserver:self forKeyPath:@"managedObjectCache" options:0 context:nil];
}
return self;
}
- (void)dealloc
{
[self removeObserver:self forKeyPath:@"managedObjectContext"];
[self removeObserver:self forKeyPath:@"targetObject"];
[self removeObserver:self forKeyPath:@"managedObjectCache"];
[_targetObjectID release];
[_parentManagedObjectContext release];
[_mainQueueManagedObjectContext release];
[_managedObjectCache release];
[_privateContext release];
[_managedObjectsByKeyPath release];
[super dealloc];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([keyPath isEqualToString:@"managedObjectContext"]) {
self.privateContext = [[[NSManagedObjectContext alloc] initWithConcurrencyType:NSPrivateQueueConcurrencyType] autorelease];
[self.privateContext performBlockAndWait:^{
self.privateContext.parentContext = self.managedObjectContext;
self.privateContext.mergePolicy = NSMergeByPropertyStoreTrumpMergePolicy;
}];
[self createMappingOperationDataSource];
} else if ([keyPath isEqualToString:@"targetObject"]) {
if (! [self.targetObject isKindOfClass:[NSManagedObject class]]) {
self.targetObjectID = nil;
}
} else if ([keyPath isEqualToString:@"managedObjectCache"]) {
[self createMappingOperationDataSource];
}
}
- (void)createMappingOperationDataSource
{
if (! self.privateContext) return;
RKManagedObjectMappingOperationDataSource *dataSource = [[RKManagedObjectMappingOperationDataSource alloc] initWithManagedObjectContext:self.privateContext
cache:self.managedObjectCache];
dataSource.operationQueue = [[NSOperationQueue new] autorelease];
[dataSource.operationQueue setSuspended:YES];
[dataSource.operationQueue setMaxConcurrentOperationCount:1];
self.mappingOperationDataSource = dataSource;
}
- (void)obtainPermanentObjectIDs
{
NSMutableArray *objectsToObtainIDs = [NSMutableArray array];
if ([self.sourceObject isKindOfClass:[NSManagedObject class]]) [objectsToObtainIDs addObject:self.sourceObject];
if ([self.targetObject isKindOfClass:[NSManagedObject class]]) [objectsToObtainIDs addObject:self.targetObject];
if ([objectsToObtainIDs count] > 0) {
[self.privateContext performBlock:^{
NSError *error;
BOOL success = [self.privateContext obtainPermanentIDsForObjects:objectsToObtainIDs error:&error];
if (! success) {
RKLogError(@"Failed to obtain permanent object ID's for %ld objects: %@", (unsigned long) [objectsToObtainIDs count], error);
}
if ([self.targetObject isKindOfClass:[NSManagedObject class]]) {
self.targetObjectID = [(NSManagedObject *)self.targetObject objectID];
}
}];
}
}
- (BOOL)prepareURLRequest
{
[self obtainPermanentObjectIDs];
return [super prepareURLRequest];
}
#pragma mark - RKObjectMapperDelegate methods
- (void)mapper:(RKObjectMapper *)objectMapper didMapFromObject:(id)sourceObject toObject:(id)destinationObject atKeyPath:(NSString *)keyPath usingMapping:(RKObjectMapping *)objectMapping
{
if ([destinationObject isKindOfClass:[NSManagedObject class]]) {
[self.managedObjectsByKeyPath setObject:destinationObject forKey:keyPath];
}
}
#pragma mark - RKObjectLoader overrides
- (RKMappingResult *)performMappingWithMapper:(RKObjectMapper *)mapper error:(NSError **)error
{
__block RKMappingResult *mappingResult = nil;
NSAssert(self.privateContext, @"Cannot have a nil private context");
// Map it
[self.privateContext performBlockAndWait:^{
if (self.targetObjectID) {
NSManagedObject *localObject = [self.privateContext existingObjectWithID:self.targetObjectID error:error];
if (! localObject) {
RKLogWarning(@"Failed to retrieve existing object with ID: %@", self.targetObjectID);
RKLogCoreDataError(*error);
}
mapper.targetObject = localObject;
}
mappingResult = [mapper performMapping:error];
}];
// Allow any enqueued operations to execute
RKManagedObjectMappingOperationDataSource *dataSource = self.mappingOperationDataSource;
// TODO: This should be eliminated. The operations should be dependent on the mapper operation itself
RKLogDebug(@"Unsuspending data source operation queue to process the following operations: %@", dataSource.operationQueue.operations);
[dataSource.operationQueue setSuspended:NO];
[dataSource.operationQueue waitUntilAllOperationsAreFinished];
return mappingResult;
}
- (NSArray *)cachedObjects
{
NSFetchRequest *fetchRequest = [self.mappingProvider fetchRequestForResourcePath:self.resourcePath];
if (fetchRequest) {
__block NSError *error = nil;
__block NSArray *cachedObjects;
[self.privateContext performBlockAndWait:^{
cachedObjects = [self.privateContext executeFetchRequest:fetchRequest error:&error];
}];
if (! cachedObjects) {
RKLogError(@"Failed to retrieve cached objects with error: %@", error);
}
return cachedObjects;
}
return nil;
}
- (void)deleteCachedObjectsMissingFromResult:(RKMappingResult *)result
{
if (! [self isGET]) {
RKLogDebug(@"Skipping cleanup of objects via managed object cache: only used for GET requests.");
return;
}
if ([self.URL isKindOfClass:[RKURL class]]) {
NSArray *results = [result asCollection];
NSArray *cachedObjects = [self cachedObjects];
for (id object in cachedObjects) {
if (NO == [results containsObject:object]) {
RKLogDebug(@"Deleting orphaned object %@: not found in result set and expected at this resource path", object);
[self.privateContext performBlockAndWait:^{
[self.privateContext deleteObject:object];
}];
}
}
} else {
RKLogWarning(@"Unable to perform cleanup of server-side object deletions: unable to determine resource path.");
}
}
// NOTE: We are on the background thread here, be mindful of Core Data's threading needs
- (void)processMappingResult:(RKMappingResult *)result
{
NSAssert(_sentSynchronously || ![NSThread isMainThread], @"Mapping result processing should occur on a background thread");
NSAssert([self.mappingOperationDataSource isKindOfClass:[RKManagedObjectMappingOperationDataSource class]], @"Expected a managed object mapping operation data source but got a %@", [self.mappingOperationDataSource class]);
if (self.targetObjectID && self.targetObject && self.method == RKRequestMethodDELETE) {
[self.privateContext performBlockAndWait:^{
NSError *error;
NSManagedObject *backgroundThreadObject = [self.privateContext existingObjectWithID:self.targetObjectID error:&error];
if (backgroundThreadObject) {
RKLogInfo(@"Deleting local object %@ due to DELETE request", backgroundThreadObject);
[self.privateContext deleteObject:backgroundThreadObject];
} else {
RKLogWarning(@"Unable to delete object sent with DELETE request: Failed to retrieve object with objectID %@", self.targetObjectID);
RKLogCoreDataError(error);
}
}];
}
// If the response was successful, save the store...
if ([self.response isSuccessful]) {
[self deleteCachedObjectsMissingFromResult:result];
__block BOOL success = NO;
__block NSError *error = nil;
NSArray *insertedObjects = [[self.privateContext insertedObjects] allObjects];
if ([insertedObjects count] > 0) {
RKLogDebug(@"Obtaining permanent object ID's for %ld objects", (unsigned long) [insertedObjects count]);
[self.privateContext performBlockAndWait:^{
success = [self.privateContext obtainPermanentIDsForObjects:insertedObjects error:&error];
}];
if (! success) {
RKLogError(@"Failed to obtain permanent object ID's for %ld managed objects. Error: %@", (unsigned long) [insertedObjects count], [error localizedDescription]);
}
}
if ([self.privateContext hasChanges]) {
[self.privateContext performBlockAndWait:^{
success = [self.privateContext save:&error];
}];
if (! success) {
RKLogError(@"Failed to save managed object context after mapping completed: %@", [error localizedDescription]);
dispatch_async(dispatch_get_main_queue(), ^{
[self performSelector:@selector(informDelegateOfError:) withObject:error];
[self finalizeLoad:success];
});
return;
}
}
}
NSDictionary *dictionary = [result asDictionary];
NSMethodSignature *signature = [self methodSignatureForSelector:@selector(informDelegateOfObjectLoadWithResultDictionary:)];
// Save back to the persistent store
NSError *error = nil;
BOOL success = [self.privateContext saveToPersistentStore:&error];
if (! success) {
RKLogError(@"Failed saving managed object context %@ to persistent store: ", self.privateContext);
RKLogCoreDataError(error);
}
RKManagedObjectThreadSafeInvocation *invocation = [RKManagedObjectThreadSafeInvocation invocationWithMethodSignature:signature];
invocation.mainQueueManagedObjectContext = self.mainQueueManagedObjectContext;
invocation.privateQueueManagedObjectContext = self.privateContext;
invocation.target = self;
invocation.selector = @selector(informDelegateOfObjectLoadWithResultDictionary:);
[invocation setArgument:&dictionary atIndex:2];
[invocation setManagedObjectKeyPaths:[NSSet setWithArray:[self.managedObjectsByKeyPath allKeys]] forArgument:2];
[invocation invokeOnMainThread];
}
- (BOOL)isResponseMappable
{
if ([self.response wasLoadedFromCache]) {
NSArray *cachedObjects = [self cachedObjects];
if (! cachedObjects) {
RKLogDebug(@"Skipping managed object mapping optimization -> Managed object cache returned nil cachedObjects for resourcePath: %@", self.resourcePath);
return [super isResponseMappable];
}
[self informDelegateOfObjectLoadWithResultDictionary:[NSDictionary dictionaryWithObject:cachedObjects forKey:@""]];
return NO;
}
return [super isResponseMappable];
}
@end
@implementation RKManagedObjectLoader (Deprecations)
+ (id)loaderWithURL:(RKURL *)URL mappingProvider:(RKObjectMappingProvider *)mappingProvider objectStore:(RKManagedObjectStore *)objectStore DEPRECATED_ATTRIBUTE
{
return [[[self alloc] initWithURL:URL mappingProvider:mappingProvider objectStore:objectStore] autorelease];
}
- (id)initWithURL:(RKURL *)URL mappingProvider:(RKObjectMappingProvider *)mappingProvider objectStore:(RKManagedObjectStore *)objectStore DEPRECATED_ATTRIBUTE
{
self = [self initWithURL:URL mappingProvider:mappingProvider];
if (self) {
self.managedObjectContext = objectStore.primaryManagedObjectContext;
self.mainQueueManagedObjectContext = objectStore.mainQueueManagedObjectContext;
}
return self;
}
@end

View File

@@ -1,54 +0,0 @@
//
// RKObjectMappingProvider+CoreData.h
// RestKit
//
// Created by Jeff Arena on 1/26/12.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
#import "RKObjectMappingProvider.h"
#import <CoreData/CoreData.h>
typedef NSFetchRequest *(^RKObjectMappingProviderFetchRequestBlock)(NSString *resourcePath);
/**
Provides extensions to RKObjectMappingProvider to support Core Data specific
functionality.
*/
@interface RKObjectMappingProvider (CoreData)
/**
Configures an object mapping to be used when during a load event where the resourcePath of
the RKObjectLoader instance matches resourcePathPattern.
The resourcePathPattern is a SOCKit pattern matching property names preceded by colons within
a path. For example, if a collection of reviews for a product were loaded from a remote system
at the resourcePath @"/products/1234/reviews", object mapping could be configured to handle
this request with a resourcePathPattern of @"/products/:productID/reviews".
**NOTE** that care must be taken when configuring patterns within the provider. The patterns
will be evaluated in the order they are added to the provider, so more specific patterns must
precede more general patterns where either would generate a match.
@param objectMapping The object mapping to use when the resourcePath matches the specified
resourcePathPattern.
@param resourcePathPattern A pattern to be evaluated using an RKPathMatcher against a resourcePath
to determine if objectMapping is the appropriate mapping.
@param fetchRequestBlock A block that accepts an individual resourcePath and returns an NSFetchRequest
that should be used to fetch the local objects associated with resourcePath from CoreData, for use in
properly processing local deletes
@see RKPathMatcher
@see RKURL
@see RKObjectLoader
*/
- (void)setObjectMapping:(RKMapping *)objectMapping forResourcePathPattern:(NSString *)resourcePathPattern withFetchRequestBlock:(RKObjectMappingProviderFetchRequestBlock)fetchRequestBlock;
/**
Retrieves the NSFetchRequest object that will retrieve cached objects for a given resourcePath.
@param resourcePath A resourcePath to retrieve the fetch request for.
@return An NSFetchRequest object for fetching objects for the given resource path or nil.
*/
- (NSFetchRequest *)fetchRequestForResourcePath:(NSString *)resourcePath;
@end

View File

@@ -1,33 +0,0 @@
//
// RKObjectMappingProvider+CoreData.m
// RestKit
//
// Created by Jeff Arena on 1/26/12.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
#import "RKObjectMappingProvider+CoreData.h"
#import "RKOrderedDictionary.h"
#import "RKFixCategoryBug.h"
RK_FIX_CATEGORY_BUG(RKObjectMappingProvider_CoreData)
@implementation RKObjectMappingProvider (CoreData)
- (void)setObjectMapping:(RKMapping *)objectMapping forResourcePathPattern:(NSString *)resourcePath withFetchRequestBlock:(RKObjectMappingProviderFetchRequestBlock)fetchRequestBlock
{
[self setEntry:[RKObjectMappingProviderContextEntry contextEntryWithMapping:objectMapping
userData:Block_copy(fetchRequestBlock)] forResourcePathPattern:resourcePath];
}
- (NSFetchRequest *)fetchRequestForResourcePath:(NSString *)resourcePath
{
RKObjectMappingProviderContextEntry *entry = [self entryForResourcePath:resourcePath];
if (entry.userData) {
NSFetchRequest *(^fetchRequestBlock)(NSString *) = entry.userData;
return fetchRequestBlock(resourcePath);
}
return nil;
}
@end

View File

@@ -23,7 +23,6 @@
#import "RKAttributeMapping.h"
#import "RKRelationshipMapping.h"
#import "RKObjectSerializer.h"
#import "RKObjectMappingProvider.h"
#import "RKMappingResult.h"
#import "RKObjectMapper.h"
#import "RKParserRegistry.h"

View File

@@ -23,7 +23,6 @@
#import "RKObjectMapping.h"
#import "RKMappingOperation.h"
#import "RKMappingResult.h"
#import "RKObjectMappingProvider.h"
#import "RKMappingOperationDataSource.h"
#import "RKErrors.h"
#import "Support.h"
@@ -34,16 +33,11 @@
@property (nonatomic, strong, readonly) id sourceObject;
@property (nonatomic, weak) id targetObject;
@property (nonatomic, strong, readonly) RKObjectMappingProvider *mappingProvider;
@property (nonatomic, strong, readwrite) NSDictionary *mappingsDictionary; // TODO: Becomes read-only...
@property (nonatomic, assign) RKObjectMappingProviderContext context;
@property (nonatomic, weak) id<RKObjectMapperDelegate> delegate;
@property (nonatomic, readonly) NSArray *errors;
@property (nonatomic, strong) id<RKMappingOperationDataSource> mappingOperationDataSource;
+ (id)mapperWithObject:(id)object mappingProvider:(RKObjectMappingProvider *)mappingProvider;
- (id)initWithObject:(id)object mappingProvider:(RKObjectMappingProvider *)mappingProvider;
- (id)initWithObject:(id)object mappingsDictionary:(NSDictionary *)mappingsDictionary;
// Primary entry point for the mapper. Examines the type of object and processes it appropriately...

View File

@@ -20,10 +20,10 @@
#import "RKObjectMapper.h"
#import "RKObjectMapper_Private.h"
#import "RKObjectMappingProvider+Contexts.h"
#import "RKObjectMappingOperationDataSource.h"
#import "RKMappingErrors.h"
#import "RKResponseDescriptor.h"
#import "RKDynamicMapping.h"
NSString * const RKMappingErrorKeyPathErrorKey = @"keyPath";
@@ -35,31 +35,11 @@ NSString * const RKMappingErrorKeyPathErrorKey = @"keyPath";
@property (nonatomic, strong) NSMutableArray *mappingErrors;
@property (nonatomic, strong) id sourceObject;
@property (nonatomic, strong, readwrite) RKObjectMappingProvider *mappingProvider;
//@property (nonatomic, strong, readwrite) NSDictionary *mappingsDictionary; // TODO: Becomes read-only
@end
@implementation RKObjectMapper
+ (id)mapperWithObject:(id)object mappingProvider:(RKObjectMappingProvider *)mappingProvider
{
return [[self alloc] initWithObject:object mappingProvider:mappingProvider];
}
- (id)initWithObject:(id)object mappingProvider:(RKObjectMappingProvider *)mappingProvider
{
self = [super init];
if (self) {
self.sourceObject = object;
self.mappingProvider = mappingProvider;
self.mappingErrors = [NSMutableArray new];
self.context = RKObjectMappingProviderContextObjectsByKeyPath;
self.mappingOperationDataSource = [RKObjectMappingOperationDataSource new];
}
return self;
}
- (id)initWithObject:(id)object mappingsDictionary:(NSDictionary *)mappingsDictionary;
{
self = [super init];
@@ -67,7 +47,6 @@ NSString * const RKMappingErrorKeyPathErrorKey = @"keyPath";
self.sourceObject = object;
self.mappingsDictionary = mappingsDictionary;
self.mappingErrors = [NSMutableArray new];
self.context = RKObjectMappingProviderContextObjectsByKeyPath;
self.mappingOperationDataSource = [RKObjectMappingOperationDataSource new];
}
@@ -343,7 +322,7 @@ NSString * const RKMappingErrorKeyPathErrorKey = @"keyPath";
- (RKMappingResult *)performMapping:(NSError **)error
{
NSAssert(self.sourceObject != nil, @"Cannot perform object mapping without a source object to map from");
NSAssert(self.mappingProvider || self.mappingsDictionary, @"Cannot perform object mapping without an object mapping provider or dictionary of mappings");
NSAssert(self.mappingsDictionary, @"Cannot perform object mapping without a dictionary of mappings");
RKLogDebug(@"Performing object mapping sourceObject: %@\n and targetObject: %@", self.sourceObject, self.targetObject);
@@ -353,33 +332,8 @@ NSString * const RKMappingErrorKeyPathErrorKey = @"keyPath";
// Perform the mapping
BOOL foundMappable = NO;
NSMutableDictionary *results = nil;
// Handle mapping selection for context
if ([[self.mappingsDictionary allKeys] count] > 0) {
results = [self performKeyPathMappingUsingMappingDictionary:self.mappingsDictionary];
foundMappable = (results != nil);
} else {
// Legacy RKObjectMappingProvider support...
id mappingsForContext = [self.mappingProvider valueForContext:self.context];
if ([mappingsForContext isKindOfClass:[NSDictionary class]]) {
results = [self performKeyPathMappingUsingMappingDictionary:mappingsForContext];
foundMappable = (results != nil);
} else if ([mappingsForContext isKindOfClass:[RKMapping class]]) {
id mappableData = self.sourceObject;
if ([mappingsForContext rootKeyPath] != nil) {
NSString *rootKeyPath = [mappingsForContext rootKeyPath];
mappableData = [self.sourceObject valueForKeyPath:rootKeyPath];
RKLogDebug(@"Selected object mapping has rootKeyPath. Apply valueForKeyPath to mappable data: %@", rootKeyPath);
}
if (mappableData) {
id mappingResult = [self performMappingForObject:mappableData atKeyPath:@"" usingMapping:mappingsForContext];
foundMappable = YES;
results = mappingResult ? [NSDictionary dictionaryWithObject:mappingResult forKey:@""] : nil;
}
}
}
NSMutableDictionary *results = [self performKeyPathMappingUsingMappingDictionary:self.mappingsDictionary];
foundMappable = (results != nil);
if ([self.delegate respondsToSelector:@selector(mapperDidFinishMapping:)]) {
[self.delegate mapperDidFinishMapping:self];

View File

@@ -1,50 +0,0 @@
//
// RKObjectMappingProvider.m
// RestKit
//
// Created by Blake Watters on 1/17/12.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import "RKObjectMappingProvider.h"
// Contexts provide primitives for managing collections of object mappings namespaced
// within a single mapping provider. This enables easy reuse and extension via categories.
@interface RKObjectMappingProvider (Contexts)
- (void)initializeContext:(RKObjectMappingProviderContext)context withValue:(id)value;
- (id)valueForContext:(RKObjectMappingProviderContext)context;
- (void)setValue:(id)value forContext:(RKObjectMappingProviderContext)context;
- (RKMapping *)mappingForContext:(RKObjectMappingProviderContext)context;
/**
Stores a single object mapping for a given context. Useful when a component needs to enable
configuration via one (and only one) object mapping.
*/
- (void)setMapping:(RKMapping *)mapping context:(RKObjectMappingProviderContext)context;
- (NSArray *)mappingsForContext:(RKObjectMappingProviderContext)context;
- (void)addMapping:(RKMapping *)mapping context:(RKObjectMappingProviderContext)context;
- (void)removeMapping:(RKMapping *)mapping context:(RKObjectMappingProviderContext)context;
- (RKMapping *)mappingForKeyPath:(NSString *)keyPath context:(RKObjectMappingProviderContext)context;
- (void)setMapping:(RKMapping *)mapping forKeyPath:(NSString *)keyPath context:(RKObjectMappingProviderContext)context;
- (void)removeMappingForKeyPath:(NSString *)keyPath context:(RKObjectMappingProviderContext)context;
- (void)setMapping:(RKMapping *)mapping forPattern:(NSString *)pattern atIndex:(NSUInteger)index context:(RKObjectMappingProviderContext)context;
- (void)setMapping:(RKMapping *)mapping forPattern:(NSString *)pattern context:(RKObjectMappingProviderContext)context;
- (RKMapping *)mappingForPatternMatchingString:(NSString *)string context:(RKObjectMappingProviderContext)context;
- (void)setEntry:(RKObjectMappingProviderContextEntry *)entry forPattern:(NSString *)pattern context:(RKObjectMappingProviderContext)context;
- (RKObjectMappingProviderContextEntry *)entryForPatternMatchingString:(NSString *)string context:(RKObjectMappingProviderContext)context;
@end

View File

@@ -1,254 +0,0 @@
//
// RKObjectMappingProvider.h
// RestKit
//
// Created by Jeremy Ellison on 5/6/11.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import "RKObjectMapping.h"
#import "RKDynamicMapping.h"
#import "RKObjectMappingProviderContextEntry.h"
// Internal framework contexts
// @see RKObjectMappingProvider+Contexts.h
typedef enum {
RKObjectMappingProviderContextObjectsByKeyPath = 1000,
RKObjectMappingProviderContextObjectsByType,
RKObjectMappingProviderContextObjectsByResourcePathPattern,
RKObjectMappingProviderContextSerialization,
RKObjectMappingProviderContextErrors,
RKObjectMappingProviderContextPagination
} RKObjectMappingProviderContext;
/**
The mapping provider is a repository of registered object mappings for use by instances
of RKObjectManager and RKObjectMapper. It provides for the storage and retrieval of object
mappings by keyPath and type.
The mapping provider is responsible for:
1. Providing instances of RKObjectMapper with keyPaths and object mappings for use
when attempting to map a parsed payload into objects. Each keyPath is examined using
valueForKeyPath: to determine if any mappable data exists within the payload. If data is
found, the RKObjectMapper will instantiate an RKObjectMappingOperation to perform the mapping
using the RKObjectMapping or RKDynamicMapping associated with the keyPath.
1. Providing the appropriate serialization mapping to instances of RKObjectManager when an object
is to be sent to the remote server using [RKObjectManager postObject:delegate:] or
[RKObjectManager postObject:delegate]. This mapping is used to serialize the object into a
format suitable for encoding into a URL form encoded or JSON representation.
1. Providing convenient storage of RKObjectMapping references for users who are not using keyPath
based mapping. Mappings can be added to the provider and retrieved by the [RKObjectMapping objectClass]
that they target.
*/
@interface RKObjectMappingProvider : NSObject {
NSMutableDictionary *mappingContexts;
}
/**
Creates and returns an autoreleased RKObjectMappingProvider instance.
@return A new autoreleased object mapping provider instance.
*/
+ (id)mappingProvider;
/**
Instantiate and return a new auto-released object mapping provider after
yielding it to the specified block for configuration
*/
+ (id)mappingProviderUsingBlock:(void (^)(RKObjectMappingProvider *))block;
/**
Configures the mapping provider to use the RKObjectMapping or RKDynamicMapping provided when
content is encountered at the specified keyPath.
When an RKObjectMapper is performing its work, each registered keyPath within the mapping provider will
be searched for content in the parsed payload. If mappable content is found, the object mapping configured
for the keyPath will be used to perform an RKObjectMappingOperation.
@param objectOrDynamicMapping An RKObjectMapping or RKDynamicMapping to register for keyPath based mapping.
@param keyPath The keyPath to register the mapping as being responsible for mapping.
@see RKObjectMapper
@see RKObjectMappingOperation
*/
- (void)setObjectMapping:(RKMapping *)objectOrDynamicMapping forKeyPath:(NSString *)keyPath;
/**
Returns the RKObjectMapping or RKObjectDynamic mapping configured for use
when mappable content is encountered at keyPath
@param keyPath A registered keyPath to retrieve the object mapping for
@return The RKObjectMapping or RKDynamicMapping for the specified keyPath or nil if none is registered.
*/
- (RKMapping *)objectMappingForKeyPath:(NSString *)keyPath;
/**
Removes the RKObjectMapping or RKDynamicMapping registered at the specified keyPath
from the provider.
@param keyPath The keyPath to remove the corresponding mapping for
*/
- (void)removeObjectMappingForKeyPath:(NSString *)keyPath;
/**
Returns a dictionary where the keys are mappable keyPaths and the values are the RKObjectMapping
or RKDynamicMapping to use for mappable data that appears at the keyPath.
@warning The returned dictionary can contain RKDynamicMapping instances. Check the type if
you are using dynamic mapping.
@return A dictionary of all registered keyPaths and their corresponding object mapping instances
*/
- (NSDictionary *)objectMappingsByKeyPath;
/**
Adds an object mapping to the provider for later retrieval. The mapping is not bound to a particular keyPath and
must be explicitly set on an instance of RKObjectLoader or RKObjectMappingOperation to be applied. This is useful
in cases where the remote system does not namespace resources in a keyPath that can be used for disambiguation.
You can retrieve mappings added to the provider by invoking objectMappingsForClass: and objectMappingForClass:
@param objectMapping An object mapping instance we wish to register with the provider.
@see objectMappingsForClass:
@see objectMappingForClass:
*/
- (void)addObjectMapping:(RKObjectMapping *)objectMapping;
/**
Returns all object mappings registered for a particular class on the provider. The collection of mappings is assembled
by searching for all mappings added via addObjctMapping: and then consulting those registered via objectMappingForKeyPath:
@param objectClass The class we want to retrieve the mappings for
@return An array of all object mappings matching the objectClass. Can be empty.
*/
- (NSArray *)objectMappingsForClass:(Class)objectClass;
/**
Returns the first object mapping for a objectClass registered in the provider.
The objectClass is the class for a model you use to represent data retrieved in
XML or JSON format. For example, if we were developing a Twitter application we
might have an objectClass of RKTweet for storing Tweet data. We could retrieve
the object mapping for this model by invoking
`[mappingProvider objectMappingForClass:[RKTweet class]];`
Mappings registered via addObjectMapping: take precedence over those registered
via setObjectMapping:forKeyPath:.
@param objectClass The class that we want to return mappings for
@return An RKObjectMapping matching objectClass or nil
*/
- (RKObjectMapping *)objectMappingForClass:(Class)objectClass;
/**
Registers an object mapping for use when serializing instances of objectClass for transport
over HTTP. Used by the object manager during postObject: and putObject:.
Serialization mappings are simply instances of RKObjectMapping that target NSMutableDictionary
as the target object class. After the object is mapped into an NSMutableDictionary, it can be
encoded to form encoded string, JSON, XML, etc.
@param objectMapping The serialization mapping to register for use when serializing objectClass
@param objectClass The class of the object type we are registering a serialization for
@see [RKObjectMapping serializationMapping]
*/
- (void)setSerializationMapping:(RKObjectMapping *)objectMapping forClass:(Class)objectClass;
/**
Returns the serialization mapping for a specific object class
which has been previously registered.
@param objectClass The class we wish to obtain the serialization mapping for
@return The RKObjectMapping instance used for mapping instances of objectClass for transport
@see setSerializationMapping:forClass:
*/
- (RKObjectMapping *)serializationMappingForClass:(Class)objectClass;
/**
Configures an object mapping to be used when during a load event where the resourcePath of
the RKObjectLoader instance matches resourcePathPattern.
The resourcePathPattern is a SOCKit pattern matching property names preceded by colons within
a path. For example, if a collection of reviews for a product were loaded from a remote system
at the resourcePath @"/products/1234/reviews", object mapping could be configured to handle
this request with a resourcePathPattern of @"/products/:productID/reviews".
**NOTE** that care must be taken when configuring patterns within the provider. The patterns
will be evaluated in the order they are added to the provider, so more specific patterns must
precede more general patterns where either would generate a match.
@param objectMapping The object mapping to use when the resourcePath matches the specified
resourcePathPattern.
@param resourcePathPattern A pattern to be evaluated using an RKPathMatcher against a resourcePath
to determine if objectMapping is the appropriate mapping.
@see RKPathMatcher
@see RKURL
@see RKObjectLoader
*/
- (void)setObjectMapping:(RKMapping *)objectMapping forResourcePathPattern:(NSString *)resourcePathPattern;
/**
Returns the first objectMapping configured in the provider with a resourcePathPattern matching
the specified resourcePath.
@param resourcePath A resource path to retrieve the first RKObjectMapping or RKDynamicMapping
configured with a matching pattern.
@return An RKObjectMapping or RKDynamicMapping for a resource path pattern matching resourcePath
or nil if no match was found.
*/
- (RKMapping *)objectMappingForResourcePath:(NSString *)resourcePath;
- (void)setEntry:(RKObjectMappingProviderContextEntry *)entry forResourcePathPattern:(NSString *)resourcePath;
- (RKObjectMappingProviderContextEntry *)entryForResourcePath:(NSString *)resourcePath;
- (RKObjectMappingProviderContextEntry *)entryForResourcePathPattern:(NSString *)resourcePathPattern;
- (RKMapping *)objectMappingForResourcePathPattern:(NSString *)resourcePathPattern;
/**
An object mapping used when the remote system returns an error status code
and a payload with a MIME Type that RestKit is capable of parsing.
@see RKObjectLoader
@see RKParserRegistry
*/
@property (nonatomic, retain) RKObjectMapping *errorMapping;
/**
An object mapping used when mapping pagination metadata (current page, object count, etc)
during a paginated object loading operation. The objectClass of the paginationMapping must
be RKObjectPaginator.
For example, if using the popular will_paginate plugin with Ruby on Rails, we would configure
our pagination mapping like so:
// Assumes the JSON format of http://stackoverflow.com/questions/4699182/will-paginate-json-support
RKObjectMapping *paginationMapping = [RKObjectMapping mappingForClass:[RKObjectPaginator class]];
[paginationMapping mapKeyPath:@"current_page" toAttribute:@"currentPage"];
[paginationMapping mapKeyPath:@"per_page" toAttribute:@"perPage"];
[paginationMapping mapKeyPath:@"total_entries" toAttribute:@"objectCount"];
@see RKObjectPaginator
*/
@property (nonatomic, retain) RKObjectMapping *paginationMapping;
@end
// Method signatures being phased out
@interface RKObjectMappingProvider (Deprecations)
+ (RKObjectMappingProvider *)objectMappingProvider;
- (void)setMapping:(RKMapping *)objectOrDynamicMapping forKeyPath:(NSString *)keyPath;
- (RKMapping *)mappingForKeyPath:(NSString *)keyPath;
- (NSDictionary *)mappingsByKeyPath;
- (void)removeMappingForKeyPath:(NSString *)keyPath;
@end

View File

@@ -1,378 +0,0 @@
//
// RKObjectMappingProvider.m
// RestKit
//
// Created by Jeremy Ellison on 5/6/11.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import "RKObjectMappingProvider.h"
#import "RKObjectMappingProvider+Contexts.h"
#import "RKOrderedDictionary.h"
#import "RKPathMatcher.h"
#import "RKObjectMappingProviderContextEntry.h"
#import "RKErrorMessage.h"
@implementation RKObjectMappingProvider
+ (RKObjectMappingProvider *)mappingProvider
{
return [[self new] autorelease];
}
+ (RKObjectMappingProvider *)mappingProviderUsingBlock:(void (^)(RKObjectMappingProvider *mappingProvider))block
{
RKObjectMappingProvider *mappingProvider = [self mappingProvider];
block(mappingProvider);
return mappingProvider;
}
- (id)init
{
self = [super init];
if (self) {
mappingContexts = [NSMutableDictionary new];
[self initializeContext:RKObjectMappingProviderContextObjectsByKeyPath withValue:[NSMutableDictionary dictionary]];
[self initializeContext:RKObjectMappingProviderContextObjectsByType withValue:[NSMutableArray array]];
[self initializeContext:RKObjectMappingProviderContextObjectsByResourcePathPattern withValue:[RKOrderedDictionary dictionary]];
[self initializeContext:RKObjectMappingProviderContextSerialization withValue:[NSMutableDictionary dictionary]];
[self initializeContext:RKObjectMappingProviderContextErrors withValue:[NSNull null]];
}
return self;
}
- (void)dealloc
{
[mappingContexts release];
[super dealloc];
}
- (void)setObjectMapping:(RKMapping *)objectOrDynamicMapping forKeyPath:(NSString *)keyPath
{
[self setMapping:objectOrDynamicMapping forKeyPath:keyPath context:RKObjectMappingProviderContextObjectsByKeyPath];
}
- (void)removeObjectMappingForKeyPath:(NSString *)keyPath
{
[self removeMappingForKeyPath:keyPath context:RKObjectMappingProviderContextObjectsByKeyPath];
}
- (RKMapping *)objectMappingForKeyPath:(NSString *)keyPath
{
return [self mappingForKeyPath:keyPath context:RKObjectMappingProviderContextObjectsByKeyPath];
}
- (void)setSerializationMapping:(RKObjectMapping *)mapping forClass:(Class)objectClass
{
[self setMapping:mapping forKeyPath:NSStringFromClass(objectClass) context:RKObjectMappingProviderContextSerialization];
}
- (RKObjectMapping *)serializationMappingForClass:(Class)objectClass
{
return (RKObjectMapping *)[self mappingForKeyPath:NSStringFromClass(objectClass) context:RKObjectMappingProviderContextSerialization];
}
- (NSDictionary *)objectMappingsByKeyPath
{
return [NSDictionary dictionaryWithDictionary:(NSDictionary *)[self valueForContext:RKObjectMappingProviderContextObjectsByKeyPath]];
}
- (void)addObjectMapping:(RKObjectMapping *)objectMapping
{
[self addMapping:objectMapping context:RKObjectMappingProviderContextObjectsByType];
}
- (NSArray *)objectMappingsForClass:(Class)theClass
{
NSMutableArray *mappings = [NSMutableArray array];
NSArray *mappingByType = [self valueForContext:RKObjectMappingProviderContextObjectsByType];
NSArray *mappingByKeyPath = [[self valueForContext:RKObjectMappingProviderContextObjectsByKeyPath] allValues];
NSArray *mappingsToSearch = [[NSArray arrayWithArray:mappingByType] arrayByAddingObjectsFromArray:mappingByKeyPath];
for (RKMapping *candidateMapping in mappingsToSearch) {
if (![candidateMapping respondsToSelector:@selector(objectClass)] || [mappings containsObject:candidateMapping])
continue;
Class mappedClass = [candidateMapping performSelector:@selector(objectClass)];
if (mappedClass && [NSStringFromClass(mappedClass) isEqualToString:NSStringFromClass(theClass)]) {
[mappings addObject:candidateMapping];
}
}
return [NSArray arrayWithArray:mappings];
}
- (RKObjectMapping *)objectMappingForClass:(Class)theClass
{
NSArray *objectMappings = [self objectMappingsForClass:theClass];
return ([objectMappings count] > 0) ? [objectMappings objectAtIndex:0] : nil;
}
#pragma mark - Error Mappings
- (RKObjectMapping *)errorMapping
{
return (RKObjectMapping *)[self mappingForContext:RKObjectMappingProviderContextErrors];
}
- (void)setErrorMapping:(RKObjectMapping *)errorMapping
{
if (errorMapping) {
[self setMapping:errorMapping context:RKObjectMappingProviderContextErrors];
}
}
#pragma mark - Pagination Mapping
- (RKObjectMapping *)paginationMapping
{
return (RKObjectMapping *)[self mappingForContext:RKObjectMappingProviderContextPagination];
}
- (void)setPaginationMapping:(RKObjectMapping *)paginationMapping
{
[self setMapping:paginationMapping context:RKObjectMappingProviderContextPagination];
}
- (void)setObjectMapping:(RKMapping *)objectMapping forResourcePathPattern:(NSString *)resourcePath
{
[self setMapping:objectMapping forPattern:resourcePath context:RKObjectMappingProviderContextObjectsByResourcePathPattern];
}
- (RKMapping *)objectMappingForResourcePath:(NSString *)resourcePath
{
return [self mappingForPatternMatchingString:resourcePath context:RKObjectMappingProviderContextObjectsByResourcePathPattern];
}
- (void)setEntry:(RKObjectMappingProviderContextEntry *)entry forResourcePathPattern:(NSString *)resourcePath
{
[self setEntry:entry forPattern:resourcePath context:RKObjectMappingProviderContextObjectsByResourcePathPattern];
}
- (RKObjectMappingProviderContextEntry *)entryForResourcePath:(NSString *)resourcePath
{
return [self entryForPatternMatchingString:resourcePath context:RKObjectMappingProviderContextObjectsByResourcePathPattern];
}
- (RKObjectMappingProviderContextEntry *)entryForResourcePathPattern:(NSString *)resourcePathPattern {
RKOrderedDictionary *contextValue = [self valueForContext:RKObjectMappingProviderContextObjectsByResourcePathPattern];
for (NSString *pattern in contextValue) {
if ([pattern isEqualToString:resourcePathPattern]) {
return [contextValue objectForKey:pattern];
}
}
return nil;
}
- (RKMapping *)objectMappingForResourcePathPattern:(NSString *)resourcePathPattern {
RKObjectMappingProviderContextEntry *entry = [self entryForResourcePathPattern:resourcePathPattern];
return entry.mapping;
}
#pragma mark - Mapping Context Primitives
- (void)initializeContext:(RKObjectMappingProviderContext)context withValue:(id)value
{
NSAssert([self valueForContext:context] == nil, @"Attempt to reinitialized an existing mapping provider context.");
[self setValue:value forContext:context];
}
- (id)valueForContext:(RKObjectMappingProviderContext)context
{
NSNumber *contextNumber = [NSNumber numberWithInteger:context];
return [mappingContexts objectForKey:contextNumber];
}
- (void)setValue:(id)value forContext:(RKObjectMappingProviderContext)context
{
NSNumber *contextNumber = [NSNumber numberWithInteger:context];
[mappingContexts setObject:value forKey:contextNumber];
}
- (void)assertStorageForContext:(RKObjectMappingProviderContext)context isKindOfClass:(Class)theClass
{
id contextValue = [self valueForContext:context];
NSAssert([contextValue isKindOfClass:theClass], @"Storage type mismatch for context %d: expected a %@, got %@.", context, theClass, [contextValue class]);
}
- (void)setMapping:(RKMapping *)mapping context:(RKObjectMappingProviderContext)context
{
NSNumber *contextNumber = [NSNumber numberWithInteger:context];
[mappingContexts setObject:mapping forKey:contextNumber];
}
- (RKMapping *)mappingForContext:(RKObjectMappingProviderContext)context
{
id contextValue = [self valueForContext:context];
if ([contextValue isEqual:[NSNull null]]) return nil;
Class class = [RKMapping class];
NSAssert([contextValue isKindOfClass:class], @"Storage type mismatch for context %d: expected a %@, got %@.", context, class, [contextValue class]);
return contextValue;
}
- (NSArray *)mappingsForContext:(RKObjectMappingProviderContext)context
{
id contextValue = [self valueForContext:context];
if (contextValue == nil) return [NSArray array];
[self assertStorageForContext:context isKindOfClass:[NSArray class]];
return [NSArray arrayWithArray:contextValue];
}
- (void)addMapping:(RKMapping *)mapping context:(RKObjectMappingProviderContext)context
{
NSMutableArray *contextValue = [self valueForContext:context];
if (contextValue == nil) {
contextValue = [NSMutableArray arrayWithCapacity:1];
[self setValue:contextValue forContext:context];
}
[self assertStorageForContext:context isKindOfClass:[NSArray class]];
[contextValue addObject:mapping];
}
- (void)removeMapping:(RKMapping *)mapping context:(RKObjectMappingProviderContext)context
{
NSMutableArray *contextValue = [self valueForContext:context];
NSAssert(contextValue, @"Attempted to remove mapping from undefined context: %d", context);
[self assertStorageForContext:context isKindOfClass:[NSArray class]];
NSAssert([contextValue containsObject:mapping], @"Attempted to remove mapping from collection that does not include it for context: %d", context);
[contextValue removeObject:mapping];
}
- (RKMapping *)mappingForKeyPath:(NSString *)keyPath context:(RKObjectMappingProviderContext)context
{
NSMutableDictionary *contextValue = [self valueForContext:context];
NSAssert(contextValue, @"Attempted to retrieve mapping from undefined context: %d", context);
[self assertStorageForContext:context isKindOfClass:[NSDictionary class]];
return [contextValue valueForKey:keyPath];
}
- (void)setMapping:(RKMapping *)mapping forKeyPath:(NSString *)keyPath context:(RKObjectMappingProviderContext)context
{
NSMutableDictionary *contextValue = [self valueForContext:context];
if (contextValue == nil) {
contextValue = [NSMutableDictionary dictionary];
[self setValue:contextValue forContext:context];
}
[self assertStorageForContext:context isKindOfClass:[NSDictionary class]];
[contextValue setValue:mapping forKey:keyPath];
}
- (void)removeMappingForKeyPath:(NSString *)keyPath context:(RKObjectMappingProviderContext)context
{
NSMutableDictionary *contextValue = [self valueForContext:context];
[self assertStorageForContext:context isKindOfClass:[NSDictionary class]];
[contextValue removeObjectForKey:keyPath];
}
- (void)setMapping:(RKMapping *)mapping forPattern:(NSString *)pattern atIndex:(NSUInteger)index context:(RKObjectMappingProviderContext)context
{
RKOrderedDictionary *contextValue = [self valueForContext:context];
if (contextValue == nil) {
contextValue = [RKOrderedDictionary dictionary];
[self setValue:contextValue forContext:context];
}
[self assertStorageForContext:context isKindOfClass:[RKOrderedDictionary class]];
[contextValue insertObject:[RKObjectMappingProviderContextEntry contextEntryWithMapping:mapping]
forKey:pattern
atIndex:index];
}
- (void)setMapping:(RKMapping *)mapping forPattern:(NSString *)pattern context:(RKObjectMappingProviderContext)context
{
RKOrderedDictionary *contextValue = [self valueForContext:context];
if (contextValue == nil) {
contextValue = [RKOrderedDictionary dictionary];
[self setValue:contextValue forContext:context];
}
[self assertStorageForContext:context isKindOfClass:[RKOrderedDictionary class]];
[contextValue setObject:[RKObjectMappingProviderContextEntry contextEntryWithMapping:mapping]
forKey:pattern];
}
- (RKMapping *)mappingForPatternMatchingString:(NSString *)string context:(RKObjectMappingProviderContext)context
{
NSAssert(string, @"Cannot look up mapping matching nil pattern string.");
RKOrderedDictionary *contextValue = [self valueForContext:context];
NSAssert(contextValue, @"Attempted to retrieve mapping from undefined context: %d", context);
for (NSString *pattern in contextValue) {
RKPathMatcher *pathMatcher = [RKPathMatcher matcherWithPattern:pattern];
if ([pathMatcher matchesPath:string tokenizeQueryStrings:NO parsedArguments:nil]) {
RKObjectMappingProviderContextEntry *entry = [contextValue objectForKey:pattern];
return entry.mapping;
}
}
return nil;
}
- (void)setEntry:(RKObjectMappingProviderContextEntry *)entry forPattern:(NSString *)pattern context:(RKObjectMappingProviderContext)context
{
RKOrderedDictionary *contextValue = [self valueForContext:context];
if (contextValue == nil) {
contextValue = [RKOrderedDictionary dictionary];
[self setValue:contextValue forContext:context];
}
[self assertStorageForContext:context isKindOfClass:[RKOrderedDictionary class]];
[contextValue setObject:entry
forKey:pattern];
}
- (RKObjectMappingProviderContextEntry *)entryForPatternMatchingString:(NSString *)string context:(RKObjectMappingProviderContext)context
{
RKOrderedDictionary *contextValue = [self valueForContext:context];
NSAssert(contextValue, @"Attempted to retrieve mapping from undefined context: %d", context);
for (NSString *pattern in contextValue) {
RKPathMatcher *pathMatcher = [RKPathMatcher matcherWithPattern:pattern];
if ([pathMatcher matchesPath:string tokenizeQueryStrings:NO parsedArguments:nil]) {
return [contextValue objectForKey:pattern];
}
}
return nil;
}
#pragma mark - Aliases
+ (RKObjectMappingProvider *)objectMappingProvider
{
return [self mappingProvider];
}
- (RKObjectMapping *)mappingForKeyPath:(NSString *)keyPath
{
return (RKObjectMapping *)[self objectMappingForKeyPath:keyPath];
}
- (void)setMapping:(RKObjectMapping *)mapping forKeyPath:(NSString *)keyPath
{
[self setObjectMapping:mapping forKeyPath:keyPath];
}
- (NSDictionary *)mappingsByKeyPath
{
return [self objectMappingsByKeyPath];
}
- (void)removeMappingForKeyPath:(NSString *)keyPath
{
[self removeObjectMappingForKeyPath:keyPath];
}
// Deprecated
+ (id)mappingProviderWithBlock:(void (^)(RKObjectMappingProvider *))block
{
return [self mappingProviderUsingBlock:block];
}
@end

View File

@@ -1,19 +0,0 @@
//
// RKObjectMappingProviderContextEntry.h
// RestKit
//
// Created by Jeff Arena on 1/26/12.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
#import "RKMapping.h"
@interface RKObjectMappingProviderContextEntry : NSObject
+ (RKObjectMappingProviderContextEntry *)contextEntryWithMapping:(RKMapping *)mapping;
+ (RKObjectMappingProviderContextEntry *)contextEntryWithMapping:(RKMapping *)mapping userData:(id)userData;
@property (nonatomic, retain) RKMapping *mapping;
@property (nonatomic, retain) id userData;
@end

View File

@@ -1,66 +0,0 @@
//
// RKObjectMappingProviderContextEntry.m
// RestKit
//
// Created by Jeff Arena on 1/26/12.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
#import "RKObjectMappingProviderContextEntry.h"
@implementation RKObjectMappingProviderContextEntry
@synthesize mapping = _mapping;
@synthesize userData = _userData;
- (id)init
{
self = [super init];
if (self) {
_mapping = nil;
_userData = nil;
}
return self;
}
- (void)dealloc
{
[_mapping release];
_mapping = nil;
[_userData release];
_userData = nil;
[super dealloc];
}
- (BOOL)isEqual:(id)object
{
if ([object isKindOfClass:[RKObjectMappingProviderContextEntry class]]) {
RKObjectMappingProviderContextEntry *entry = (RKObjectMappingProviderContextEntry *)object;
return ([self.mapping isEqual:entry.mapping] && (self.userData == entry.userData));
}
return NO;
}
- (NSUInteger)hash
{
NSUInteger prime = 31;
NSUInteger result = 1;
result = prime *[self.userData hash] ? [self.mapping hash] : [self.userData hash];
return result;
}
+ (RKObjectMappingProviderContextEntry *)contextEntryWithMapping:(RKMapping *)mapping
{
RKObjectMappingProviderContextEntry *contextEntry = [[[RKObjectMappingProviderContextEntry alloc] init] autorelease];
contextEntry.mapping = mapping;
return contextEntry;
}
+ (RKObjectMappingProviderContextEntry *)contextEntryWithMapping:(RKMapping *)mapping userData:(id)userData
{
RKObjectMappingProviderContextEntry *contextEntry = [RKObjectMappingProviderContextEntry contextEntryWithMapping:mapping];
contextEntry.userData = userData;
return contextEntry;
}
@end

View File

@@ -14,6 +14,5 @@
*/
NSString * const RKTestFactoryDefaultNamesClient = @"client";
NSString * const RKTestFactoryDefaultNamesObjectManager = @"objectManager";
NSString * const RKTestFactoryDefaultNamesMappingProvider = @"mappingProvider";
NSString * const RKTestFactoryDefaultNamesManagedObjectStore = @"managedObjectStore";
NSString * const RKTestFactoryDefaultStoreFilename = @"RKTests.sqlite";

View File

@@ -182,14 +182,6 @@ extern NSString * const RKTestFactoryDefaultNamesManagedObjectStore;
*/
+ (id)objectManager;
/**
Creates and returns an RKObjectMappingProvider instance using the factory defined
for the name RKTestFactoryDefaultNamesMappingProvider.
@return A new object mapping provider instance.
*/
+ (id)mappingProvider;
/**
Creates and returns a RKManagedObjectStore instance using the factory defined
for the name RKTestFactoryDefaultNamesManagedObjectStore.

View File

@@ -95,22 +95,12 @@ static RKTestFactory *sharedFactory = nil;
RKLogSilenceComponentWhileExecutingBlock(lcl_cRestKitNetworkReachability, ^{
RKLogSilenceComponentWhileExecutingBlock(lcl_cRestKitSupport, ^{
objectManager = [RKObjectManager managerWithBaseURL:self.baseURL];
RKObjectMappingProvider *mappingProvider = [self objectFromFactory:RKTestFactoryDefaultNamesMappingProvider];
objectManager.mappingProvider = mappingProvider;
// Force reachability determination
[objectManager.client.reachabilityObserver getFlags];
});
});
return objectManager;
}];
[self defineFactory:RKTestFactoryDefaultNamesMappingProvider withBlock:^id {
RKObjectMappingProvider *mappingProvider = [RKObjectMappingProvider mappingProvider];
return mappingProvider;
}];
[self defineFactory:RKTestFactoryDefaultNamesManagedObjectStore withBlock:^id {
NSString *storePath = [RKApplicationDataDirectory() stringByAppendingPathComponent:RKTestFactoryDefaultStoreFilename];
RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] init];
@@ -191,13 +181,6 @@ static RKTestFactory *sharedFactory = nil;
return objectManager;
}
+ (id)mappingProvider
{
RKObjectMappingProvider *mappingProvider = [self objectFromFactory:RKTestFactoryDefaultNamesMappingProvider];
return mappingProvider;
}
+ (id)managedObjectStore
{
RKManagedObjectStore *managedObjectStore = [self objectFromFactory:RKTestFactoryDefaultNamesManagedObjectStore];

View File

@@ -33,8 +33,6 @@
250DF22B14C5190E0001DEFA /* RKOrderedDictionary.h in Headers */ = {isa = PBXBuildFile; fileRef = 250DF22814C5190E0001DEFA /* RKOrderedDictionary.h */; settings = {ATTRIBUTES = (Public, ); }; };
250DF22C14C5190E0001DEFA /* RKOrderedDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 250DF22914C5190E0001DEFA /* RKOrderedDictionary.m */; };
250DF22D14C5190E0001DEFA /* RKOrderedDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 250DF22914C5190E0001DEFA /* RKOrderedDictionary.m */; };
250DF25F14C680F90001DEFA /* RKObjectMappingProvider+Contexts.h in Headers */ = {isa = PBXBuildFile; fileRef = 250DF25E14C680F90001DEFA /* RKObjectMappingProvider+Contexts.h */; settings = {ATTRIBUTES = (Public, ); }; };
250DF26014C680F90001DEFA /* RKObjectMappingProvider+Contexts.h in Headers */ = {isa = PBXBuildFile; fileRef = 250DF25E14C680F90001DEFA /* RKObjectMappingProvider+Contexts.h */; settings = {ATTRIBUTES = (Public, ); }; };
25104F1F15C30CD900829135 /* RKSearchWord.h in Headers */ = {isa = PBXBuildFile; fileRef = 25104F1315C30CD900829135 /* RKSearchWord.h */; };
25104F2015C30CD900829135 /* RKSearchWord.h in Headers */ = {isa = PBXBuildFile; fileRef = 25104F1315C30CD900829135 /* RKSearchWord.h */; };
25104F2115C30CD900829135 /* RKSearchWord.m in Sources */ = {isa = PBXBuildFile; fileRef = 25104F1415C30CD900829135 /* RKSearchWord.m */; };
@@ -101,8 +99,6 @@
25160E1C145650490060A5C5 /* RKMapping.h in Headers */ = {isa = PBXBuildFile; fileRef = 25160D8F145650490060A5C5 /* RKMapping.h */; settings = {ATTRIBUTES = (Public, ); }; };
25160E1D145650490060A5C5 /* RKMappingOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 25160D90145650490060A5C5 /* RKMappingOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
25160E1E145650490060A5C5 /* RKMappingOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 25160D91145650490060A5C5 /* RKMappingOperation.m */; };
25160E1F145650490060A5C5 /* RKObjectMappingProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 25160D92145650490060A5C5 /* RKObjectMappingProvider.h */; settings = {ATTRIBUTES = (Public, ); }; };
25160E20145650490060A5C5 /* RKObjectMappingProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 25160D93145650490060A5C5 /* RKObjectMappingProvider.m */; };
25160E21145650490060A5C5 /* RKMappingResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 25160D94145650490060A5C5 /* RKMappingResult.h */; settings = {ATTRIBUTES = (Public, ); }; };
25160E22145650490060A5C5 /* RKMappingResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 25160D95145650490060A5C5 /* RKMappingResult.m */; };
25160E23145650490060A5C5 /* RKPropertyInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 25160D96145650490060A5C5 /* RKPropertyInspector.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -210,8 +206,6 @@
25160F57145655C60060A5C5 /* RKMapping.h in Headers */ = {isa = PBXBuildFile; fileRef = 25160D8F145650490060A5C5 /* RKMapping.h */; settings = {ATTRIBUTES = (Public, ); }; };
25160F58145655C60060A5C5 /* RKMappingOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 25160D90145650490060A5C5 /* RKMappingOperation.h */; settings = {ATTRIBUTES = (Public, ); }; };
25160F59145655C60060A5C5 /* RKMappingOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 25160D91145650490060A5C5 /* RKMappingOperation.m */; };
25160F5A145655C60060A5C5 /* RKObjectMappingProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 25160D92145650490060A5C5 /* RKObjectMappingProvider.h */; settings = {ATTRIBUTES = (Public, ); }; };
25160F5B145655C60060A5C5 /* RKObjectMappingProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 25160D93145650490060A5C5 /* RKObjectMappingProvider.m */; };
25160F5C145655C60060A5C5 /* RKMappingResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 25160D94145650490060A5C5 /* RKMappingResult.h */; settings = {ATTRIBUTES = (Public, ); }; };
25160F5D145655C60060A5C5 /* RKMappingResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 25160D95145650490060A5C5 /* RKMappingResult.m */; };
25160F5E145655C60060A5C5 /* RKPropertyInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 25160D96145650490060A5C5 /* RKPropertyInspector.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -477,10 +471,6 @@
257ABAB71511371E00CCAA76 /* NSManagedObject+RKAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 257ABAB41511371C00CCAA76 /* NSManagedObject+RKAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
257ABAB81511371E00CCAA76 /* NSManagedObject+RKAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 257ABAB51511371D00CCAA76 /* NSManagedObject+RKAdditions.m */; };
257ABAB91511371E00CCAA76 /* NSManagedObject+RKAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 257ABAB51511371D00CCAA76 /* NSManagedObject+RKAdditions.m */; };
258113C815781848009835EB /* RKObjectMappingProvider+CoreData.h in Headers */ = {isa = PBXBuildFile; fileRef = 258113C615781848009835EB /* RKObjectMappingProvider+CoreData.h */; settings = {ATTRIBUTES = (Public, ); }; };
258113C915781848009835EB /* RKObjectMappingProvider+CoreData.h in Headers */ = {isa = PBXBuildFile; fileRef = 258113C615781848009835EB /* RKObjectMappingProvider+CoreData.h */; settings = {ATTRIBUTES = (Public, ); }; };
258113CD15781871009835EB /* RKObjectMappingProvider+CoreData.m in Sources */ = {isa = PBXBuildFile; fileRef = 258113CC15781871009835EB /* RKObjectMappingProvider+CoreData.m */; };
258113CE15781871009835EB /* RKObjectMappingProvider+CoreData.m in Sources */ = {isa = PBXBuildFile; fileRef = 258113CC15781871009835EB /* RKObjectMappingProvider+CoreData.m */; };
258EA4A815A38BC0007E07A6 /* RKObjectMappingOperationDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 258EA4A615A38BBF007E07A6 /* RKObjectMappingOperationDataSource.h */; settings = {ATTRIBUTES = (Private, ); }; };
258EA4A915A38BC0007E07A6 /* RKObjectMappingOperationDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 258EA4A615A38BBF007E07A6 /* RKObjectMappingOperationDataSource.h */; settings = {ATTRIBUTES = (Private, ); }; };
258EA4AA15A38BC0007E07A6 /* RKObjectMappingOperationDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 258EA4A715A38BBF007E07A6 /* RKObjectMappingOperationDataSource.m */; };
@@ -686,10 +676,6 @@
25EC1A3E14F72B2900C3CF3F /* RKInMemoryManagedObjectCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 7394DF3C14CF19F200CE7BCE /* RKInMemoryManagedObjectCache.h */; settings = {ATTRIBUTES = (Public, ); }; };
25EC1A3F14F72B3100C3CF3F /* RKInMemoryManagedObjectCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 7394DF3D14CF19F200CE7BCE /* RKInMemoryManagedObjectCache.m */; };
25EC1A4014F72B3300C3CF3F /* RKInMemoryManagedObjectCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 7394DF3D14CF19F200CE7BCE /* RKInMemoryManagedObjectCache.m */; };
25EC1A4514F7393D00C3CF3F /* RKObjectMappingProviderContextEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 73DA8E2114D1C3870054DD73 /* RKObjectMappingProviderContextEntry.m */; };
25EC1A4614F7393E00C3CF3F /* RKObjectMappingProviderContextEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = 73DA8E2114D1C3870054DD73 /* RKObjectMappingProviderContextEntry.m */; };
25EC1A4714F7394100C3CF3F /* RKObjectMappingProviderContextEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 73DA8E2014D1C3870054DD73 /* RKObjectMappingProviderContextEntry.h */; settings = {ATTRIBUTES = (Public, ); }; };
25EC1A4814F7394200C3CF3F /* RKObjectMappingProviderContextEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = 73DA8E2014D1C3870054DD73 /* RKObjectMappingProviderContextEntry.h */; settings = {ATTRIBUTES = (Public, ); }; };
25EC1A6314F7402A00C3CF3F /* RKManagedObjectCaching.h in Headers */ = {isa = PBXBuildFile; fileRef = 7394DF3514CF157A00CE7BCE /* RKManagedObjectCaching.h */; settings = {ATTRIBUTES = (Public, ); }; };
25EC1A6514F7402A00C3CF3F /* RKManagedObjectCaching.h in Headers */ = {isa = PBXBuildFile; fileRef = 7394DF3514CF157A00CE7BCE /* RKManagedObjectCaching.h */; settings = {ATTRIBUTES = (Public, ); }; };
25F53ADC15E7B150008B54E6 /* RKRequestDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 25F53ADA15E7B150008B54E6 /* RKRequestDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -785,7 +771,6 @@
250CA67C147D8E800047D347 /* OCHamcrestIOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OCHamcrestIOS.framework; sourceTree = "<group>"; };
250DF22814C5190E0001DEFA /* RKOrderedDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKOrderedDictionary.h; sourceTree = "<group>"; };
250DF22914C5190E0001DEFA /* RKOrderedDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKOrderedDictionary.m; sourceTree = "<group>"; };
250DF25E14C680F90001DEFA /* RKObjectMappingProvider+Contexts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RKObjectMappingProvider+Contexts.h"; sourceTree = "<group>"; };
25104F1315C30CD900829135 /* RKSearchWord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKSearchWord.h; sourceTree = "<group>"; };
25104F1415C30CD900829135 /* RKSearchWord.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKSearchWord.m; sourceTree = "<group>"; };
25104F2715C30D1700829135 /* RKManagedObjectStore+RKSearchAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RKManagedObjectStore+RKSearchAdditions.h"; sourceTree = "<group>"; };
@@ -842,8 +827,6 @@
25160D8F145650490060A5C5 /* RKMapping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKMapping.h; sourceTree = "<group>"; };
25160D90145650490060A5C5 /* RKMappingOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKMappingOperation.h; sourceTree = "<group>"; };
25160D91145650490060A5C5 /* RKMappingOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKMappingOperation.m; sourceTree = "<group>"; };
25160D92145650490060A5C5 /* RKObjectMappingProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKObjectMappingProvider.h; sourceTree = "<group>"; };
25160D93145650490060A5C5 /* RKObjectMappingProvider.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKObjectMappingProvider.m; sourceTree = "<group>"; };
25160D94145650490060A5C5 /* RKMappingResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKMappingResult.h; sourceTree = "<group>"; };
25160D95145650490060A5C5 /* RKMappingResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKMappingResult.m; sourceTree = "<group>"; };
25160D96145650490060A5C5 /* RKPropertyInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKPropertyInspector.h; sourceTree = "<group>"; };
@@ -1046,8 +1029,6 @@
257ABAAF15112DD400CCAA76 /* NSManagedObjectContext+RKAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSManagedObjectContext+RKAdditions.m"; sourceTree = "<group>"; };
257ABAB41511371C00CCAA76 /* NSManagedObject+RKAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSManagedObject+RKAdditions.h"; sourceTree = "<group>"; };
257ABAB51511371D00CCAA76 /* NSManagedObject+RKAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSManagedObject+RKAdditions.m"; sourceTree = "<group>"; };
258113C615781848009835EB /* RKObjectMappingProvider+CoreData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RKObjectMappingProvider+CoreData.h"; sourceTree = "<group>"; };
258113CC15781871009835EB /* RKObjectMappingProvider+CoreData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RKObjectMappingProvider+CoreData.m"; sourceTree = "<group>"; };
258EA4A615A38BBF007E07A6 /* RKObjectMappingOperationDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKObjectMappingOperationDataSource.h; sourceTree = "<group>"; };
258EA4A715A38BBF007E07A6 /* RKObjectMappingOperationDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKObjectMappingOperationDataSource.m; sourceTree = "<group>"; };
258EA4AD15A38E7D007E07A6 /* RKMappingOperationDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKMappingOperationDataSource.h; sourceTree = "<group>"; };
@@ -1215,8 +1196,6 @@
73D3907114CA19F90093E3D6 /* parent.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = parent.json; sourceTree = "<group>"; };
73D3907314CA1A4A0093E3D6 /* child.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = child.json; sourceTree = "<group>"; };
73D3907814CA1D710093E3D6 /* channels.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = channels.xml; sourceTree = "<group>"; };
73DA8E2014D1C3870054DD73 /* RKObjectMappingProviderContextEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKObjectMappingProviderContextEntry.h; sourceTree = "<group>"; };
73DA8E2114D1C3870054DD73 /* RKObjectMappingProviderContextEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKObjectMappingProviderContextEntry.m; sourceTree = "<group>"; };
8BC044C81576CE72003DCDD6 /* RKConnectionMapping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKConnectionMapping.h; sourceTree = "<group>"; };
8BC044C91576CE72003DCDD6 /* RKConnectionMapping.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKConnectionMapping.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -1416,8 +1395,6 @@
259D98531550C69A008C90F5 /* RKEntityByAttributeCache.m */,
259D985C155218E4008C90F5 /* RKEntityCache.h */,
259D985D155218E4008C90F5 /* RKEntityCache.m */,
258113C615781848009835EB /* RKObjectMappingProvider+CoreData.h */,
258113CC15781871009835EB /* RKObjectMappingProvider+CoreData.m */,
258EA4B015A3908F007E07A6 /* RKManagedObjectMappingOperationDataSource.h */,
25AA23CF15AF291F006EF62D /* RKManagedObjectMappingOperationDataSource.m */,
2597F99A15AF6DC400E547D7 /* RKRelationshipConnectionOperation.h */,
@@ -1477,11 +1454,6 @@
25160D8F145650490060A5C5 /* RKMapping.h */,
25160D90145650490060A5C5 /* RKMappingOperation.h */,
25160D91145650490060A5C5 /* RKMappingOperation.m */,
250DF25E14C680F90001DEFA /* RKObjectMappingProvider+Contexts.h */,
25160D92145650490060A5C5 /* RKObjectMappingProvider.h */,
25160D93145650490060A5C5 /* RKObjectMappingProvider.m */,
73DA8E2014D1C3870054DD73 /* RKObjectMappingProviderContextEntry.h */,
73DA8E2114D1C3870054DD73 /* RKObjectMappingProviderContextEntry.m */,
25160D94145650490060A5C5 /* RKMappingResult.h */,
25160D95145650490060A5C5 /* RKMappingResult.m */,
254A62B714AD544200939BEE /* RKObjectPaginator.h */,
@@ -2231,7 +2203,6 @@
8BC044CA1576CE72003DCDD6 /* RKConnectionMapping.h in Headers */,
252028FC1577AE0B00076FB4 /* RKRouteSet.h in Headers */,
252029031577AE1800076FB4 /* RKRoute.h in Headers */,
258113C815781848009835EB /* RKObjectMappingProvider+CoreData.h in Headers */,
25545959155F0527007D7625 /* RKBenchmark.h in Headers */,
25FBB852159272DD00955D27 /* RKRouter.h in Headers */,
258EA4A815A38BC0007E07A6 /* RKObjectMappingOperationDataSource.h in Headers */,
@@ -2296,7 +2267,6 @@
25160F55145655C60060A5C5 /* RKObjectMapping.h in Headers */,
25160F57145655C60060A5C5 /* RKMapping.h in Headers */,
25160F58145655C60060A5C5 /* RKMappingOperation.h in Headers */,
25160F5A145655C60060A5C5 /* RKObjectMappingProvider.h in Headers */,
25160F5C145655C60060A5C5 /* RKMappingResult.h in Headers */,
25160F5E145655C60060A5C5 /* RKPropertyInspector.h in Headers */,
25160F60145655C60060A5C5 /* RKRelationshipMapping.h in Headers */,
@@ -2330,7 +2300,6 @@
250DF22B14C5190E0001DEFA /* RKOrderedDictionary.h in Headers */,
49A66B1314CF03CA00A6F062 /* RKXMLParserXMLReader.h in Headers */,
49D2759E14C9EF1E0090845D /* ISO8601DateFormatter.h in Headers */,
250DF26014C680F90001DEFA /* RKObjectMappingProvider+Contexts.h in Headers */,
49D275AE14C9F3020090845D /* RKISO8601DateFormatter.h in Headers */,
25B6E95614CF795D00B1E881 /* RKErrors.h in Headers */,
25B6E95D14CF7E3C00B1E881 /* RKDynamicMappingMatcher.h in Headers */,
@@ -2346,7 +2315,6 @@
25055B9014EEF40000B9C4DD /* RKMappingTestExpectation.h in Headers */,
25EC1A3A14F72B0A00C3CF3F /* RKFetchRequestManagedObjectCache.h in Headers */,
25EC1A3E14F72B2900C3CF3F /* RKInMemoryManagedObjectCache.h in Headers */,
25EC1A4814F7394200C3CF3F /* RKObjectMappingProviderContextEntry.h in Headers */,
25EC1A6514F7402A00C3CF3F /* RKManagedObjectCaching.h in Headers */,
257ABAB115112DD500CCAA76 /* NSManagedObjectContext+RKAdditions.h in Headers */,
257ABAB71511371E00CCAA76 /* NSManagedObject+RKAdditions.h in Headers */,
@@ -2360,7 +2328,6 @@
25AE61CA15ADEBD000B319C8 /* RKConnectionMapping.h in Headers */,
252028FD1577AE0B00076FB4 /* RKRouteSet.h in Headers */,
252029041577AE1800076FB4 /* RKRoute.h in Headers */,
258113C915781848009835EB /* RKObjectMappingProvider+CoreData.h in Headers */,
25FBB853159272DD00955D27 /* RKRouter.h in Headers */,
258EA4A915A38BC0007E07A6 /* RKObjectMappingOperationDataSource.h in Headers */,
258EA4AF15A38E7E007E07A6 /* RKMappingOperationDataSource.h in Headers */,
@@ -2709,7 +2676,6 @@
25160E17145650490060A5C5 /* RKObjectMapper.m in Sources */,
25160E1B145650490060A5C5 /* RKObjectMapping.m in Sources */,
25160E1E145650490060A5C5 /* RKMappingOperation.m in Sources */,
25160E20145650490060A5C5 /* RKObjectMappingProvider.m in Sources */,
25160E22145650490060A5C5 /* RKMappingResult.m in Sources */,
25160E24145650490060A5C5 /* RKPropertyInspector.m in Sources */,
25160E26145650490060A5C5 /* RKRelationshipMapping.m in Sources */,
@@ -2732,7 +2698,6 @@
25160EFA1456532C0060A5C5 /* LCLNSLog.m in Sources */,
25160F0A1456532C0060A5C5 /* SOCKit.m in Sources */,
25B408281491CDDC00F21111 /* RKDirectoryUtilities.m in Sources */,
254A62BB14AD544200939BEE /* RKObjectPaginator.m in Sources */,
250DF22C14C5190E0001DEFA /* RKOrderedDictionary.m in Sources */,
49D2759F14C9EF1E0090845D /* ISO8601DateFormatter.m in Sources */,
49D275AF14C9F3020090845D /* RKISO8601DateFormatter.m in Sources */,
@@ -2751,7 +2716,6 @@
25055B9114EEF40000B9C4DD /* RKMappingTestExpectation.m in Sources */,
25EC1A3B14F72B1300C3CF3F /* RKFetchRequestManagedObjectCache.m in Sources */,
25EC1A3F14F72B3100C3CF3F /* RKInMemoryManagedObjectCache.m in Sources */,
25EC1A4514F7393D00C3CF3F /* RKObjectMappingProviderContextEntry.m in Sources */,
257ABAB215112DD500CCAA76 /* NSManagedObjectContext+RKAdditions.m in Sources */,
257ABAB81511371E00CCAA76 /* NSManagedObject+RKAdditions.m in Sources */,
25079C71151B93DB00266AE7 /* NSEntityDescription+RKAdditions.m in Sources */,
@@ -2764,7 +2728,6 @@
8BC044CB1576CE72003DCDD6 /* RKConnectionMapping.m in Sources */,
252028FE1577AE0B00076FB4 /* RKRouteSet.m in Sources */,
252029051577AE1800076FB4 /* RKRoute.m in Sources */,
258113CD15781871009835EB /* RKObjectMappingProvider+CoreData.m in Sources */,
25FBB854159272DD00955D27 /* RKRouter.m in Sources */,
258EA4AA15A38BC0007E07A6 /* RKObjectMappingOperationDataSource.m in Sources */,
25AA23D015AF2920006EF62D /* RKManagedObjectMappingOperationDataSource.m in Sources */,
@@ -2909,7 +2872,6 @@
25160F52145655C60060A5C5 /* RKObjectMapper.m in Sources */,
25160F56145655C60060A5C5 /* RKObjectMapping.m in Sources */,
25160F59145655C60060A5C5 /* RKMappingOperation.m in Sources */,
25160F5B145655C60060A5C5 /* RKObjectMappingProvider.m in Sources */,
25160F5D145655C60060A5C5 /* RKMappingResult.m in Sources */,
25160F5F145655C60060A5C5 /* RKPropertyInspector.m in Sources */,
25160F61145655C60060A5C5 /* RKRelationshipMapping.m in Sources */,
@@ -2950,7 +2912,6 @@
25055B9214EEF40000B9C4DD /* RKMappingTestExpectation.m in Sources */,
25EC1A3C14F72B1400C3CF3F /* RKFetchRequestManagedObjectCache.m in Sources */,
25EC1A4014F72B3300C3CF3F /* RKInMemoryManagedObjectCache.m in Sources */,
25EC1A4614F7393E00C3CF3F /* RKObjectMappingProviderContextEntry.m in Sources */,
257ABAB315112DD500CCAA76 /* NSManagedObjectContext+RKAdditions.m in Sources */,
257ABAB91511371E00CCAA76 /* NSManagedObject+RKAdditions.m in Sources */,
25079C72151B93DB00266AE7 /* NSEntityDescription+RKAdditions.m in Sources */,
@@ -2963,7 +2924,6 @@
25E4DAB7156DA97F00A5C84B /* RKTableControllerTestDelegate.m in Sources */,
252028FF1577AE0B00076FB4 /* RKRouteSet.m in Sources */,
252029061577AE1800076FB4 /* RKRoute.m in Sources */,
258113CE15781871009835EB /* RKObjectMappingProvider+CoreData.m in Sources */,
25FBB855159272DD00955D27 /* RKRouter.m in Sources */,
258EA4AB15A38BC0007E07A6 /* RKObjectMappingOperationDataSource.m in Sources */,
25AA23D115AF2920006EF62D /* RKManagedObjectMappingOperationDataSource.m in Sources */,