mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-01 09:31:17 +08:00
RKMappingDescriptor -> RKResponseDescriptor
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
#import "RKObjectMappingProvider+Contexts.h"
|
||||
#import "RKObjectMappingOperationDataSource.h"
|
||||
#import "RKMappingErrors.h"
|
||||
#import "RKMappingDescriptor.h"
|
||||
#import "RKResponseDescriptor.h"
|
||||
|
||||
NSString * const RKMappingErrorKeyPathErrorKey = @"keyPath";
|
||||
|
||||
@@ -304,7 +304,7 @@ NSString * const RKMappingErrorKeyPathErrorKey = @"keyPath";
|
||||
|
||||
RKLogTrace(@"Examining keyPath '%@' for mappable content...", keyPath);
|
||||
|
||||
if ([keyPath isEqualToString:@""] || [keyPath isEqual:[NSNull null]]) {
|
||||
if ([keyPath isEqual:[NSNull null]] || [keyPath isEqualToString:@""]) {
|
||||
mappableValue = self.sourceObject;
|
||||
} else {
|
||||
mappableValue = [self.sourceObject valueForKeyPath:keyPath];
|
||||
@@ -356,7 +356,7 @@ NSString * const RKMappingErrorKeyPathErrorKey = @"keyPath";
|
||||
NSMutableDictionary *results = nil;
|
||||
|
||||
// Handle mapping selection for context
|
||||
if (self.mappingsDictionary) {
|
||||
if ([[self.mappingsDictionary allKeys] count] > 0) {
|
||||
results = [self performKeyPathMappingUsingMappingDictionary:self.mappingsDictionary];
|
||||
foundMappable = (results != nil);
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// RKMappingDescriptor.h
|
||||
// RKResponseDescriptor.h
|
||||
// RestKit
|
||||
//
|
||||
// Created by Blake Watters on 8/16/12.
|
||||
@@ -55,18 +55,17 @@ NSIndexSet * RKStatusCodeIndexSetForClass(RKStatusCodeClass statusCodeClass);
|
||||
//NSInteger RKStatusCodeFromString(NSString *statusCode);
|
||||
|
||||
/**
|
||||
An RKMappingDescriptor object describes an object mapping configuration
|
||||
that is available for a given HTTP request.
|
||||
An RKResponseDescriptor object describes an object mapping configuration
|
||||
that is applicable to an HTTP response.
|
||||
*/
|
||||
// Becomes RKResponseDescriptor
|
||||
@interface RKMappingDescriptor : NSObject
|
||||
@interface RKResponseDescriptor : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) RKMapping *mapping; // required
|
||||
@property (nonatomic, strong, readonly) NSString *pathPattern; // can be nil
|
||||
@property (nonatomic, strong, readonly) NSString *keyPath; // can be nil
|
||||
@property (nonatomic, strong, readonly) NSIndexSet *statusCodes; // can be nil
|
||||
|
||||
+ (RKMappingDescriptor *)mappingDescriptorWithMapping:(RKMapping *)mapping
|
||||
+ (RKResponseDescriptor *)responseDescriptorWithMapping:(RKMapping *)mapping
|
||||
pathPattern:(NSString *)pathPattern
|
||||
keyPath:(NSString *)keyPath
|
||||
statusCodes:(NSIndexSet *)statusCodes;
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// RKMappingDescriptor.m
|
||||
// RKResponseDescriptor.m
|
||||
// RestKit
|
||||
//
|
||||
// Created by Blake Watters on 8/16/12.
|
||||
@@ -19,7 +19,7 @@
|
||||
//
|
||||
|
||||
#import <RestKit/RKPathMatcher.h>
|
||||
#import "RKMappingDescriptor.h"
|
||||
#import "RKResponseDescriptor.h"
|
||||
|
||||
NSUInteger RKStatusCodeRangeLength = 100;
|
||||
|
||||
@@ -64,21 +64,21 @@ static NSString * RKStringFromIndexSet(NSIndexSet *indexSet) {
|
||||
return string;
|
||||
}
|
||||
|
||||
@interface RKMappingDescriptor ()
|
||||
@interface RKResponseDescriptor ()
|
||||
@property (nonatomic, strong, readwrite) RKMapping *mapping;
|
||||
@property (nonatomic, strong, readwrite) NSString *pathPattern;
|
||||
@property (nonatomic, strong, readwrite) NSString *keyPath;
|
||||
@property (nonatomic, strong, readwrite) NSIndexSet *statusCodes;
|
||||
@end
|
||||
|
||||
@implementation RKMappingDescriptor
|
||||
@implementation RKResponseDescriptor
|
||||
|
||||
+ (RKMappingDescriptor *)mappingDescriptorWithMapping:(RKMapping *)mapping
|
||||
+ (RKResponseDescriptor *)responseDescriptorWithMapping:(RKMapping *)mapping
|
||||
pathPattern:(NSString *)pathPattern
|
||||
keyPath:(NSString *)keyPath
|
||||
statusCodes:(NSIndexSet *)statusCodes
|
||||
{
|
||||
RKMappingDescriptor *mappingDescriptor = [self new];
|
||||
RKResponseDescriptor *mappingDescriptor = [self new];
|
||||
mappingDescriptor.mapping = mapping;
|
||||
mappingDescriptor.pathPattern = pathPattern;
|
||||
mappingDescriptor.keyPath = keyPath;
|
||||
@@ -513,10 +513,10 @@
|
||||
2554595A155F0527007D7625 /* RKBenchmark.h in Headers */ = {isa = PBXBuildFile; fileRef = 25545957155F0527007D7625 /* RKBenchmark.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
2554595B155F0527007D7625 /* RKBenchmark.m in Sources */ = {isa = PBXBuildFile; fileRef = 25545958155F0527007D7625 /* RKBenchmark.m */; };
|
||||
2554595C155F0527007D7625 /* RKBenchmark.m in Sources */ = {isa = PBXBuildFile; fileRef = 25545958155F0527007D7625 /* RKBenchmark.m */; };
|
||||
2561872215DE8FBE006B6FBF /* RKMappingDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2561872015DE8FBE006B6FBF /* RKMappingDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
2561872315DE8FBE006B6FBF /* RKMappingDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2561872015DE8FBE006B6FBF /* RKMappingDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
2561872415DE8FBE006B6FBF /* RKMappingDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 2561872115DE8FBE006B6FBF /* RKMappingDescriptor.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
|
||||
2561872515DE8FBE006B6FBF /* RKMappingDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 2561872115DE8FBE006B6FBF /* RKMappingDescriptor.m */; };
|
||||
2561872215DE8FBE006B6FBF /* RKResponseDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2561872015DE8FBE006B6FBF /* RKResponseDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
2561872315DE8FBE006B6FBF /* RKResponseDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2561872015DE8FBE006B6FBF /* RKResponseDescriptor.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
2561872415DE8FBE006B6FBF /* RKResponseDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 2561872115DE8FBE006B6FBF /* RKResponseDescriptor.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; };
|
||||
2561872515DE8FBE006B6FBF /* RKResponseDescriptor.m in Sources */ = {isa = PBXBuildFile; fileRef = 2561872115DE8FBE006B6FBF /* RKResponseDescriptor.m */; };
|
||||
2572538D155C543000CB05ED /* RKPortCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = 2572538B155C543000CB05ED /* RKPortCheck.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
2572538E155C543000CB05ED /* RKPortCheck.h in Headers */ = {isa = PBXBuildFile; fileRef = 2572538B155C543000CB05ED /* RKPortCheck.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
2572538F155C543000CB05ED /* RKPortCheck.m in Sources */ = {isa = PBXBuildFile; fileRef = 2572538C155C543000CB05ED /* RKPortCheck.m */; };
|
||||
@@ -1104,8 +1104,8 @@
|
||||
254A62BF14AD591C00939BEE /* RKObjectPaginatorTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKObjectPaginatorTest.m; sourceTree = "<group>"; };
|
||||
25545957155F0527007D7625 /* RKBenchmark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKBenchmark.h; sourceTree = "<group>"; };
|
||||
25545958155F0527007D7625 /* RKBenchmark.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKBenchmark.m; sourceTree = "<group>"; };
|
||||
2561872015DE8FBE006B6FBF /* RKMappingDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKMappingDescriptor.h; sourceTree = "<group>"; };
|
||||
2561872115DE8FBE006B6FBF /* RKMappingDescriptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKMappingDescriptor.m; sourceTree = "<group>"; };
|
||||
2561872015DE8FBE006B6FBF /* RKResponseDescriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKResponseDescriptor.h; sourceTree = "<group>"; };
|
||||
2561872115DE8FBE006B6FBF /* RKResponseDescriptor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKResponseDescriptor.m; sourceTree = "<group>"; };
|
||||
2572538B155C543000CB05ED /* RKPortCheck.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RKPortCheck.h; sourceTree = "<group>"; };
|
||||
2572538C155C543000CB05ED /* RKPortCheck.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RKPortCheck.m; sourceTree = "<group>"; };
|
||||
257ABAAE15112DD400CCAA76 /* NSManagedObjectContext+RKAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSManagedObjectContext+RKAdditions.h"; sourceTree = "<group>"; };
|
||||
@@ -1550,8 +1550,8 @@
|
||||
25160D7A145650490060A5C5 /* ObjectMapping */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2561872015DE8FBE006B6FBF /* RKMappingDescriptor.h */,
|
||||
2561872115DE8FBE006B6FBF /* RKMappingDescriptor.m */,
|
||||
2561872015DE8FBE006B6FBF /* RKResponseDescriptor.h */,
|
||||
2561872115DE8FBE006B6FBF /* RKResponseDescriptor.m */,
|
||||
25160D7B145650490060A5C5 /* ObjectMapping.h */,
|
||||
8BC044C81576CE72003DCDD6 /* RKConnectionMapping.h */,
|
||||
8BC044C91576CE72003DCDD6 /* RKConnectionMapping.m */,
|
||||
@@ -2395,7 +2395,7 @@
|
||||
25104F3B15C30F2100829135 /* RKSearchWordEntity.h in Headers */,
|
||||
25A763D015C71ACE00A9DF31 /* Search.h in Headers */,
|
||||
25A763DB15C7240200A9DF31 /* RKSearchTokenizer.h in Headers */,
|
||||
2561872215DE8FBE006B6FBF /* RKMappingDescriptor.h in Headers */,
|
||||
2561872215DE8FBE006B6FBF /* RKResponseDescriptor.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -2525,7 +2525,7 @@
|
||||
25104F3C15C30F2100829135 /* RKSearchWordEntity.h in Headers */,
|
||||
25A763D115C71ACE00A9DF31 /* Search.h in Headers */,
|
||||
25A763DC15C7240200A9DF31 /* RKSearchTokenizer.h in Headers */,
|
||||
2561872315DE8FBE006B6FBF /* RKMappingDescriptor.h in Headers */,
|
||||
2561872315DE8FBE006B6FBF /* RKResponseDescriptor.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -2940,7 +2940,7 @@
|
||||
25104F3715C30EF500829135 /* RKSearchPredicate.m in Sources */,
|
||||
25104F3D15C30F2100829135 /* RKSearchWordEntity.m in Sources */,
|
||||
25A763DD15C7240200A9DF31 /* RKSearchTokenizer.m in Sources */,
|
||||
2561872415DE8FBE006B6FBF /* RKMappingDescriptor.m in Sources */,
|
||||
2561872415DE8FBE006B6FBF /* RKResponseDescriptor.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@@ -3140,7 +3140,7 @@
|
||||
25104F3815C30EF500829135 /* RKSearchPredicate.m in Sources */,
|
||||
25104F3E15C30F2100829135 /* RKSearchWordEntity.m in Sources */,
|
||||
25A763DE15C7240200A9DF31 /* RKSearchTokenizer.m in Sources */,
|
||||
2561872515DE8FBE006B6FBF /* RKMappingDescriptor.m in Sources */,
|
||||
2561872515DE8FBE006B6FBF /* RKResponseDescriptor.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user