mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-23 12:27:52 +08:00
Cleanup trailing whitespace. refs #743
This commit is contained in:
@@ -4,13 +4,13 @@
|
||||
//
|
||||
// Created by Blake Watters on 5/31/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.
|
||||
@@ -69,7 +69,7 @@
|
||||
[self addObserver:self forKeyPath:@"entity" options:NSKeyValueObservingOptionInitial context:nil];
|
||||
[self addObserver:self forKeyPath:@"primaryKeyAttribute" options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew context:nil];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
if (self) {
|
||||
_relationshipToPrimaryKeyMappings = [[NSMutableDictionary alloc] init];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -131,16 +131,16 @@
|
||||
return [desc defaultValue];
|
||||
}
|
||||
|
||||
- (id)mappableObjectForData:(id)mappableData {
|
||||
- (id)mappableObjectForData:(id)mappableData {
|
||||
NSAssert(mappableData, @"Mappable data cannot be nil");
|
||||
|
||||
id object = nil;
|
||||
id primaryKeyValue = nil;
|
||||
NSString* primaryKeyAttribute;
|
||||
|
||||
|
||||
NSEntityDescription* entity = [self entity];
|
||||
RKObjectAttributeMapping* primaryKeyAttributeMapping = nil;
|
||||
|
||||
|
||||
primaryKeyAttribute = [self primaryKeyAttribute];
|
||||
if (primaryKeyAttribute) {
|
||||
// If a primary key has been set on the object mapping, find the attribute mapping
|
||||
@@ -151,8 +151,8 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the primary key value out of the mappable data (if any)
|
||||
|
||||
// Get the primary key value out of the mappable data (if any)
|
||||
if ([primaryKeyAttributeMapping isMappingForKeyOfNestedDictionary]) {
|
||||
RKLogDebug(@"Detected use of nested dictionary key as primaryKey attribute...");
|
||||
primaryKeyValue = [[mappableData allKeys] lastObject];
|
||||
@@ -163,16 +163,16 @@
|
||||
} else {
|
||||
RKLogWarning(@"Unable to find source attribute for primaryKeyAttribute '%@': unable to find existing object instances by primary key.", primaryKeyAttribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If we have found the primary key attribute & value, try to find an existing instance to update
|
||||
if (primaryKeyAttribute && primaryKeyValue && NO == [primaryKeyValue isEqual:[NSNull null]]) {
|
||||
object = [self.objectStore.cacheStrategy findInstanceOfEntity:entity
|
||||
withPrimaryKeyAttribute:primaryKeyAttribute
|
||||
value:primaryKeyValue
|
||||
object = [self.objectStore.cacheStrategy findInstanceOfEntity:entity
|
||||
withPrimaryKeyAttribute:primaryKeyAttribute
|
||||
value:primaryKeyValue
|
||||
inManagedObjectContext:[self.objectStore managedObjectContextForCurrentThread]];
|
||||
|
||||
|
||||
if (object && [self.objectStore.cacheStrategy respondsToSelector:@selector(didFetchObject:)]) {
|
||||
[self.objectStore.cacheStrategy didFetchObject:object];
|
||||
}
|
||||
@@ -184,7 +184,7 @@
|
||||
if (primaryKeyAttribute && primaryKeyValue && ![primaryKeyValue isEqual:[NSNull null]]) {
|
||||
[object setValue:primaryKeyValue forKey:primaryKeyAttribute];
|
||||
}
|
||||
|
||||
|
||||
if ([self.objectStore.cacheStrategy respondsToSelector:@selector(didCreateObject:)]) {
|
||||
[self.objectStore.cacheStrategy didCreateObject:object];
|
||||
}
|
||||
@@ -197,7 +197,7 @@
|
||||
if (! propertyClass) {
|
||||
propertyClass = [[RKObjectPropertyInspector sharedInspector] typeForProperty:propertyName ofEntity:self.entity];
|
||||
}
|
||||
|
||||
|
||||
return propertyClass;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user