mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-03-27 01:34:45 +08:00
Use instancetype in constructors for increased subclassing friendliness
This commit is contained in:
@@ -88,7 +88,7 @@
|
||||
@param sourceToDestinationEntityAttributes A dictionary specifying how attributes on the source entity correspond to attributes on the destination entity.
|
||||
@return The receiver, initialized with the given relationship and attributes.
|
||||
*/
|
||||
- (id)initWithRelationship:(NSRelationshipDescription *)relationship attributes:(NSDictionary *)sourceToDestinationEntityAttributes;
|
||||
- (instancetype)initWithRelationship:(NSRelationshipDescription *)relationship attributes:(NSDictionary *)sourceToDestinationEntityAttributes;
|
||||
|
||||
/**
|
||||
The dictionary of attributes specifying how attributes on the source entity for the relationship correspond to attributes on the destination entity.
|
||||
@@ -115,7 +115,7 @@
|
||||
@param keyPath The key path from which to read the value that is to be set for the relationship.
|
||||
@return The receiver, initialized with the given relationship and key path.
|
||||
*/
|
||||
- (id)initWithRelationship:(NSRelationshipDescription *)relationship keyPath:(NSString *)keyPath;
|
||||
- (instancetype)initWithRelationship:(NSRelationshipDescription *)relationship keyPath:(NSString *)keyPath;
|
||||
|
||||
/**
|
||||
The key path that is to be evaluated to obtain the value for the relationship.
|
||||
|
||||
@@ -44,7 +44,7 @@ static NSSet *RKSetWithInvalidAttributesForEntity(NSArray *attributes, NSEntityD
|
||||
|
||||
@implementation RKConnectionDescription
|
||||
|
||||
- (id)initWithRelationship:(NSRelationshipDescription *)relationship attributes:(NSDictionary *)attributes
|
||||
- (instancetype)initWithRelationship:(NSRelationshipDescription *)relationship attributes:(NSDictionary *)attributes
|
||||
{
|
||||
NSParameterAssert(relationship);
|
||||
NSParameterAssert(attributes);
|
||||
@@ -63,7 +63,7 @@ static NSSet *RKSetWithInvalidAttributesForEntity(NSArray *attributes, NSEntityD
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithRelationship:(NSRelationshipDescription *)relationship keyPath:(NSString *)keyPath
|
||||
- (instancetype)initWithRelationship:(NSRelationshipDescription *)relationship keyPath:(NSString *)keyPath
|
||||
{
|
||||
NSParameterAssert(relationship);
|
||||
NSParameterAssert(keyPath);
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
@return The receiver, initialized with the given entity, attribute, and managed object
|
||||
context.
|
||||
*/
|
||||
- (id)initWithEntity:(NSEntityDescription *)entity attributes:(NSArray *)attributeNames managedObjectContext:(NSManagedObjectContext *)context;
|
||||
- (instancetype)initWithEntity:(NSEntityDescription *)entity attributes:(NSArray *)attributeNames managedObjectContext:(NSManagedObjectContext *)context;
|
||||
|
||||
///-----------------------------
|
||||
/// @name Getting Cache Identity
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
@param context The managed object context containing objects to be cached.
|
||||
@returns self, initialized with context.
|
||||
*/
|
||||
- (id)initWithManagedObjectContext:(NSManagedObjectContext *)context;
|
||||
- (instancetype)initWithManagedObjectContext:(NSManagedObjectContext *)context;
|
||||
|
||||
/**
|
||||
The managed object context with which the receiver is associated.
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
@implementation RKEntityCache
|
||||
|
||||
|
||||
- (id)initWithManagedObjectContext:(NSManagedObjectContext *)context
|
||||
{
|
||||
NSAssert(context, @"Cannot initialize entity cache with a nil context");
|
||||
@@ -45,7 +44,6 @@
|
||||
return [self initWithManagedObjectContext:nil];
|
||||
}
|
||||
|
||||
|
||||
- (void)cacheObjectsForEntity:(NSEntityDescription *)entity byAttributes:(NSArray *)attributeNames
|
||||
{
|
||||
NSParameterAssert(entity);
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
@param entity An entity with which to initialize the receiver.
|
||||
@returns The receiver, initialized with the given entity.
|
||||
*/
|
||||
- (id)initWithEntity:(NSEntityDescription *)entity;
|
||||
- (instancetype)initWithEntity:(NSEntityDescription *)entity;
|
||||
|
||||
/**
|
||||
A convenience initializer that creates and returns an entity mapping for the entity with the given name in
|
||||
@@ -83,7 +83,7 @@
|
||||
@param managedObjectStore A managed object store containing the managed object model in which an entity with the given name is defined.
|
||||
@return A new entity mapping for the entity with the given name in the managed object model of the given managed object store.
|
||||
*/
|
||||
+ (id)mappingForEntityForName:(NSString *)entityName inManagedObjectStore:(RKManagedObjectStore *)managedObjectStore;
|
||||
+ (instancetype)mappingForEntityForName:(NSString *)entityName inManagedObjectStore:(RKManagedObjectStore *)managedObjectStore;
|
||||
|
||||
///---------------------------
|
||||
/// @name Accessing the Entity
|
||||
|
||||
@@ -140,20 +140,20 @@ static BOOL entityIdentificationInferenceEnabled = YES;
|
||||
|
||||
@synthesize identificationAttributes = _identificationAttributes;
|
||||
|
||||
+ (id)mappingForClass:(Class)objectClass
|
||||
+ (instancetype)mappingForClass:(Class)objectClass
|
||||
{
|
||||
@throw [NSException exceptionWithName:NSInternalInconsistencyException
|
||||
reason:[NSString stringWithFormat:@"You must provide a managedObjectStore. Invoke mappingForClass:inManagedObjectStore: instead."]
|
||||
userInfo:nil];
|
||||
}
|
||||
|
||||
+ (id)mappingForEntityForName:(NSString *)entityName inManagedObjectStore:(RKManagedObjectStore *)managedObjectStore
|
||||
+ (instancetype)mappingForEntityForName:(NSString *)entityName inManagedObjectStore:(RKManagedObjectStore *)managedObjectStore
|
||||
{
|
||||
NSEntityDescription *entity = [[managedObjectStore.managedObjectModel entitiesByName] objectForKey:entityName];
|
||||
return [[self alloc] initWithEntity:entity];
|
||||
}
|
||||
|
||||
- (id)initWithEntity:(NSEntityDescription *)entity
|
||||
- (instancetype)initWithEntity:(NSEntityDescription *)entity
|
||||
{
|
||||
NSAssert(entity, @"Cannot initialize an RKEntityMapping without an entity. Maybe you want RKObjectMapping instead?");
|
||||
Class objectClass = NSClassFromString([entity managedObjectClassName]);
|
||||
@@ -167,7 +167,7 @@ static BOOL entityIdentificationInferenceEnabled = YES;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithClass:(Class)objectClass
|
||||
- (instancetype)initWithClass:(Class)objectClass
|
||||
{
|
||||
self = [super initWithClass:objectClass];
|
||||
if (self) {
|
||||
|
||||
@@ -35,6 +35,6 @@
|
||||
@param managedObjectContext The managed object context with which to initialize the receiver.
|
||||
@return The receiver, initialized with the given managed object context.
|
||||
*/
|
||||
- (id)initWithManagedObjectContext:(NSManagedObjectContext *)managedObjectContext;
|
||||
- (instancetype)initWithManagedObjectContext:(NSManagedObjectContext *)managedObjectContext;
|
||||
|
||||
@end
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
@warning As this initialization code path is typical for generating seed databases, the value of
|
||||
`resetsStoreBeforeImporting` is initialized to **YES**.
|
||||
*/
|
||||
- (id)initWithManagedObjectModel:(NSManagedObjectModel *)managedObjectModel storePath:(NSString *)storePath;
|
||||
- (instancetype)initWithManagedObjectModel:(NSManagedObjectModel *)managedObjectModel storePath:(NSString *)storePath;
|
||||
|
||||
/**
|
||||
Initializes the receiver with a given persistent store in which to persist imported managed objects.
|
||||
@@ -69,7 +69,7 @@
|
||||
managed object model are determined from the given persistent store and a new managed object context with
|
||||
the private queue concurrency type is constructed.
|
||||
*/
|
||||
- (id)initWithPersistentStore:(NSPersistentStore *)persistentStore;
|
||||
- (instancetype)initWithPersistentStore:(NSPersistentStore *)persistentStore;
|
||||
|
||||
/**
|
||||
A Boolean value indicating whether existing managed objects in the persistent store should
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
@param managedObjectCache The managed object cache used by the receiver to find existing object instances by their identification attributes.
|
||||
@return The receiver, initialized with the given managed object context and managed objet cache.
|
||||
*/
|
||||
- (id)initWithManagedObjectContext:(NSManagedObjectContext *)managedObjectContext cache:(id<RKManagedObjectCaching>)managedObjectCache;
|
||||
- (instancetype)initWithManagedObjectContext:(NSManagedObjectContext *)managedObjectContext cache:(id<RKManagedObjectCaching>)managedObjectCache;
|
||||
|
||||
///-----------------------------------------------------
|
||||
/// @name Accessing the Managed Object Context and Cache
|
||||
|
||||
@@ -128,7 +128,7 @@ extern NSString * const RKObjectMappingNestingAttributeKeyName;
|
||||
|
||||
@implementation RKManagedObjectMappingOperationDataSource
|
||||
|
||||
- (id)initWithManagedObjectContext:(NSManagedObjectContext *)managedObjectContext cache:(id<RKManagedObjectCaching>)managedObjectCache
|
||||
- (instancetype)initWithManagedObjectContext:(NSManagedObjectContext *)managedObjectContext cache:(id<RKManagedObjectCaching>)managedObjectCache
|
||||
{
|
||||
NSParameterAssert(managedObjectContext);
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
@return The default managed object store.
|
||||
*/
|
||||
+ (RKManagedObjectStore *)defaultStore;
|
||||
+ (instancetype)defaultStore;
|
||||
|
||||
/**
|
||||
Sets the default managed object store for the application.
|
||||
@@ -76,7 +76,7 @@
|
||||
RKManagedObjectStore *managedObjectStore = [[RKManagedObjectStore alloc] initWithManagedObjectModel:managedObjectModel];
|
||||
|
||||
*/
|
||||
- (id)initWithManagedObjectModel:(NSManagedObjectModel *)managedObjectModel;
|
||||
- (instancetype)initWithManagedObjectModel:(NSManagedObjectModel *)managedObjectModel;
|
||||
|
||||
/**
|
||||
Initializes the receiver with an existing persistent store coordinator.
|
||||
@@ -88,7 +88,7 @@
|
||||
@param persistentStoreCoordinator The persistent store coordinator with which to initialize the receiver.
|
||||
@return The receiver, initialized with the managed object model of the given persistent store coordinator and the persistent store coordinator.
|
||||
*/
|
||||
- (id)initWithPersistentStoreCoordinator:(NSPersistentStoreCoordinator *)persistentStoreCoordinator;
|
||||
- (instancetype)initWithPersistentStoreCoordinator:(NSPersistentStoreCoordinator *)persistentStoreCoordinator;
|
||||
|
||||
/**
|
||||
Initializes the receiver with a managed object model obtained by merging the models from all of the application's non-framework bundles.
|
||||
@@ -98,7 +98,7 @@
|
||||
|
||||
@warning Obtaining a managed object model by merging all bundles may result in an application error if versioned object models are in use.
|
||||
*/
|
||||
- (id)init;
|
||||
- (instancetype)init;
|
||||
|
||||
///-----------------------------------------------------------------------------
|
||||
/// @name Configuring Persistent Stores
|
||||
|
||||
@@ -45,8 +45,7 @@ static RKManagedObjectStore *defaultStore = nil;
|
||||
|
||||
@implementation RKManagedObjectStore
|
||||
|
||||
|
||||
+ (RKManagedObjectStore *)defaultStore
|
||||
+ (instancetype)defaultStore
|
||||
{
|
||||
return defaultStore;
|
||||
}
|
||||
@@ -58,7 +57,7 @@ static RKManagedObjectStore *defaultStore = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (id)initWithManagedObjectModel:(NSManagedObjectModel *)managedObjectModel
|
||||
- (instancetype)initWithManagedObjectModel:(NSManagedObjectModel *)managedObjectModel
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
@@ -74,7 +73,7 @@ static RKManagedObjectStore *defaultStore = nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithPersistentStoreCoordinator:(NSPersistentStoreCoordinator *)persistentStoreCoordinator
|
||||
- (instancetype)initWithPersistentStoreCoordinator:(NSPersistentStoreCoordinator *)persistentStoreCoordinator
|
||||
{
|
||||
self = [self initWithManagedObjectModel:persistentStoreCoordinator.managedObjectModel];
|
||||
if (self) {
|
||||
|
||||
@@ -44,9 +44,9 @@
|
||||
@param managedObjectCache The managed object cache from which to attempt to fetch a matching object to satisfy the connection.
|
||||
@return The receiver, initialized with the given managed object, connection mapping, and managed object cache.
|
||||
*/
|
||||
- (id)initWithManagedObject:(NSManagedObject *)managedObject
|
||||
connection:(RKConnectionDescription *)connection
|
||||
managedObjectCache:(id<RKManagedObjectCaching>)managedObjectCache;
|
||||
- (instancetype)initWithManagedObject:(NSManagedObject *)managedObject
|
||||
connection:(RKConnectionDescription *)connection
|
||||
managedObjectCache:(id<RKManagedObjectCaching>)managedObjectCache;
|
||||
|
||||
///--------------------------------------------
|
||||
/// @name Accessing Details About the Operation
|
||||
|
||||
@@ -65,9 +65,9 @@ static NSDictionary *RKConnectionAttributeValuesWithObject(RKConnectionDescripti
|
||||
|
||||
@implementation RKRelationshipConnectionOperation
|
||||
|
||||
- (id)initWithManagedObject:(NSManagedObject *)managedObject
|
||||
connection:(RKConnectionDescription *)connection
|
||||
managedObjectCache:(id<RKManagedObjectCaching>)managedObjectCache;
|
||||
- (instancetype)initWithManagedObject:(NSManagedObject *)managedObject
|
||||
connection:(RKConnectionDescription *)connection
|
||||
managedObjectCache:(id<RKManagedObjectCaching>)managedObjectCache;
|
||||
{
|
||||
NSParameterAssert(managedObject);
|
||||
NSAssert([managedObject isKindOfClass:[NSManagedObject class]], @"Relationship connection requires an instance of NSManagedObject");
|
||||
|
||||
@@ -231,7 +231,7 @@ RKMappingResult, RKRequestDescriptor, RKResponseDescriptor;
|
||||
|
||||
@return The shared manager instance.
|
||||
*/
|
||||
+ (RKObjectManager *)sharedManager;
|
||||
+ (instancetype)sharedManager;
|
||||
|
||||
/**
|
||||
Set the shared instance of the object manager
|
||||
@@ -252,7 +252,7 @@ RKMappingResult, RKRequestDescriptor, RKResponseDescriptor;
|
||||
@param baseURL The base URL with which to initialize the `AFHTTPClient` object
|
||||
@return A new `RKObjectManager` initialized with an `AFHTTPClient` that was initialized with the given baseURL.
|
||||
*/
|
||||
+ (id)managerWithBaseURL:(NSURL *)baseURL;
|
||||
+ (instancetype)managerWithBaseURL:(NSURL *)baseURL;
|
||||
|
||||
/**
|
||||
Initializes the receiver with the given AFNetworking HTTP client object, adopting the network configuration from the client.
|
||||
@@ -262,7 +262,7 @@ RKMappingResult, RKRequestDescriptor, RKResponseDescriptor;
|
||||
@param client The AFNetworking HTTP client with which to initialize the receiver.
|
||||
@return The receiver, initialized with the given client.
|
||||
*/
|
||||
- (id)initWithHTTPClient:(AFHTTPClient *)client;
|
||||
- (instancetype)initWithHTTPClient:(AFHTTPClient *)client;
|
||||
|
||||
///------------------------------------------
|
||||
/// @name Accessing Object Manager Properties
|
||||
|
||||
@@ -223,7 +223,7 @@ static NSString *RKMIMETypeFromAFHTTPClientParameterEncoding(AFHTTPClientParamet
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (RKObjectManager *)sharedManager
|
||||
+ (instancetype)sharedManager
|
||||
{
|
||||
return sharedManager;
|
||||
}
|
||||
@@ -381,7 +381,7 @@ static NSString *RKMIMETypeFromAFHTTPClientParameterEncoding(AFHTTPClientParamet
|
||||
{
|
||||
RKManagedObjectRequestOperation *operation = [[RKManagedObjectRequestOperation alloc] initWithHTTPRequestOperation:[self HTTPOperationWithRequest:request] responseDescriptors:self.responseDescriptors];
|
||||
[operation setCompletionBlockWithSuccess:success failure:failure];
|
||||
operation.managedObjectContext = managedObjectContext;
|
||||
operation.managedObjectContext = managedObjectContext ?: self.managedObjectStore.mainQueueManagedObjectContext;
|
||||
operation.managedObjectCache = self.managedObjectStore.managedObjectCache;
|
||||
operation.fetchRequestBlocks = self.fetchRequestBlocks;
|
||||
return operation;
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
@param responseDescriptors An array of `RKResponseDescriptor` objects specifying how object mapping is to be performed on the response loaded by the network operation.
|
||||
@return The receiver, initialized with the given request and response descriptors.
|
||||
*/
|
||||
- (id)initWithHTTPRequestOperation:(RKHTTPRequestOperation *)requestOperation responseDescriptors:(NSArray *)responseDescriptors;
|
||||
- (instancetype)initWithHTTPRequestOperation:(RKHTTPRequestOperation *)requestOperation responseDescriptors:(NSArray *)responseDescriptors;
|
||||
|
||||
/**
|
||||
Initializes an object request operation with a request object and a set of response descriptors.
|
||||
@@ -87,7 +87,7 @@
|
||||
@param responseDescriptors An array of `RKResponseDescriptor` objects specifying how object mapping is to be performed on the response loaded by the network operation.
|
||||
@return The receiver, initialized with the given request and response descriptors.
|
||||
*/
|
||||
- (id)initWithRequest:(NSURLRequest *)request responseDescriptors:(NSArray *)responseDescriptors;
|
||||
- (instancetype)initWithRequest:(NSURLRequest *)request responseDescriptors:(NSArray *)responseDescriptors;
|
||||
|
||||
///---------------------------------
|
||||
/// @name Configuring Object Mapping
|
||||
|
||||
@@ -56,9 +56,9 @@
|
||||
@param responseDescriptors An array of response descriptors describing how to map object representations loaded by object request operations dispatched by the paginator.
|
||||
@return The receiver, initialized with the request, pagination mapping, and response descriptors.
|
||||
*/
|
||||
- (id)initWithRequest:(NSURLRequest *)request
|
||||
paginationMapping:(RKObjectMapping *)paginationMapping
|
||||
responseDescriptors:(NSArray *)responseDescriptors;
|
||||
- (instancetype)initWithRequest:(NSURLRequest *)request
|
||||
paginationMapping:(RKObjectMapping *)paginationMapping
|
||||
responseDescriptors:(NSArray *)responseDescriptors;
|
||||
|
||||
/**
|
||||
A URL with a path pattern for building a complete URL from
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
@see [RKObjectMapping requestMapping]
|
||||
@warning An exception will be raised if the objectClass of the given mapping is not `[NSMutableDictionary class]`.
|
||||
*/
|
||||
+ (id)requestDescriptorWithMapping:(RKMapping *)mapping
|
||||
objectClass:(Class)objectClass
|
||||
rootKeyPath:(NSString *)rootKeyPath;
|
||||
+ (instancetype)requestDescriptorWithMapping:(RKMapping *)mapping
|
||||
objectClass:(Class)objectClass
|
||||
rootKeyPath:(NSString *)rootKeyPath;
|
||||
|
||||
///-----------------------------------------------------
|
||||
/// @name Getting Information About a Request Descriptor
|
||||
|
||||
@@ -52,7 +52,7 @@ static void RKAssertValidMappingForRequestDescriptor(RKMapping *mapping)
|
||||
|
||||
@implementation RKRequestDescriptor
|
||||
|
||||
+ (id)requestDescriptorWithMapping:(RKMapping *)mapping objectClass:(Class)objectClass rootKeyPath:(NSString *)rootKeyPath
|
||||
+ (instancetype)requestDescriptorWithMapping:(RKMapping *)mapping objectClass:(Class)objectClass rootKeyPath:(NSString *)rootKeyPath
|
||||
{
|
||||
NSParameterAssert(mapping);
|
||||
NSParameterAssert(objectClass);
|
||||
|
||||
@@ -41,10 +41,10 @@
|
||||
@param statusCodes A set of HTTP status codes for which the mapping is to be used.
|
||||
@return A new `RKResponseDescriptor` object.
|
||||
*/
|
||||
+ (RKResponseDescriptor *)responseDescriptorWithMapping:(RKMapping *)mapping
|
||||
pathPattern:(NSString *)pathPattern
|
||||
keyPath:(NSString *)keyPath
|
||||
statusCodes:(NSIndexSet *)statusCodes;
|
||||
+ (instancetype)responseDescriptorWithMapping:(RKMapping *)mapping
|
||||
pathPattern:(NSString *)pathPattern
|
||||
keyPath:(NSString *)keyPath
|
||||
statusCodes:(NSIndexSet *)statusCodes;
|
||||
|
||||
///------------------------------------------------------
|
||||
/// @name Getting Information About a Response Descriptor
|
||||
|
||||
@@ -65,10 +65,10 @@ NSString *RKStringFromIndexSet(NSIndexSet *indexSet)
|
||||
|
||||
@implementation RKResponseDescriptor
|
||||
|
||||
+ (RKResponseDescriptor *)responseDescriptorWithMapping:(RKMapping *)mapping
|
||||
pathPattern:(NSString *)pathPattern
|
||||
keyPath:(NSString *)keyPath
|
||||
statusCodes:(NSIndexSet *)statusCodes
|
||||
+ (instancetype)responseDescriptorWithMapping:(RKMapping *)mapping
|
||||
pathPattern:(NSString *)pathPattern
|
||||
keyPath:(NSString *)keyPath
|
||||
statusCodes:(NSIndexSet *)statusCodes
|
||||
{
|
||||
NSParameterAssert(mapping);
|
||||
RKResponseDescriptor *mappingDescriptor = [self new];
|
||||
|
||||
@@ -53,9 +53,9 @@
|
||||
@param responseDescriptors An array whose elements are `RKResponseDescriptor` objects specifying object mapping configurations that may be applied to the response.
|
||||
@return The receiver, initialized with the response, data, and response descriptor objects.
|
||||
*/
|
||||
- (id)initWithResponse:(NSHTTPURLResponse *)response
|
||||
data:(NSData *)data
|
||||
responseDescriptors:(NSArray *)responseDescriptors;
|
||||
- (instancetype)initWithResponse:(NSHTTPURLResponse *)response
|
||||
data:(NSData *)data
|
||||
responseDescriptors:(NSArray *)responseDescriptors;
|
||||
|
||||
///------------------------------
|
||||
/// @name Accessing Response Data
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
@param method The request method of the route.
|
||||
@return A new named route object with the given name, path pattern and request method.
|
||||
*/
|
||||
+ (id)routeWithName:(NSString *)name pathPattern:(NSString *)pathPattern method:(RKRequestMethod)method;
|
||||
+ (instancetype)routeWithName:(NSString *)name pathPattern:(NSString *)pathPattern method:(RKRequestMethod)method;
|
||||
|
||||
/**
|
||||
Creates and returns a new class route object with the given object class, path pattern and method.
|
||||
@@ -58,7 +58,7 @@
|
||||
@param method The request method of the route.
|
||||
@return A new class route object with the given object class, path pattern and request method.
|
||||
*/
|
||||
+ (id)routeWithClass:(Class)objectClass pathPattern:(NSString *)pathPattern method:(RKRequestMethod)method;
|
||||
+ (instancetype)routeWithClass:(Class)objectClass pathPattern:(NSString *)pathPattern method:(RKRequestMethod)method;
|
||||
|
||||
/**
|
||||
Creates and returns a new relationship route object with the given relationship name, object class, path pattern and method.
|
||||
@@ -69,7 +69,7 @@
|
||||
@param method The request method of the route.
|
||||
@return A new class route object with the given object class, path pattern and request method.
|
||||
*/
|
||||
+ (id)routeWithRelationshipName:(NSString *)name objectClass:(Class)objectClass pathPattern:(NSString *)pathPattern method:(RKRequestMethod)method;
|
||||
+ (instancetype)routeWithRelationshipName:(NSString *)name objectClass:(Class)objectClass pathPattern:(NSString *)pathPattern method:(RKRequestMethod)method;
|
||||
|
||||
///---------------------------------
|
||||
/// @name Accessing Route Attributes
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
@implementation RKRoute
|
||||
|
||||
+ (id)routeWithName:(NSString *)name pathPattern:(NSString *)pathPattern method:(RKRequestMethod)method
|
||||
+ (instancetype)routeWithName:(NSString *)name pathPattern:(NSString *)pathPattern method:(RKRequestMethod)method
|
||||
{
|
||||
NSParameterAssert(name);
|
||||
NSParameterAssert(pathPattern);
|
||||
@@ -49,7 +49,7 @@
|
||||
return route;
|
||||
}
|
||||
|
||||
+ (id)routeWithClass:(Class)objectClass pathPattern:(NSString *)pathPattern method:(RKRequestMethod)method
|
||||
+ (instancetype)routeWithClass:(Class)objectClass pathPattern:(NSString *)pathPattern method:(RKRequestMethod)method
|
||||
{
|
||||
NSParameterAssert(objectClass);
|
||||
NSParameterAssert(pathPattern);
|
||||
@@ -60,7 +60,7 @@
|
||||
return route;
|
||||
}
|
||||
|
||||
+ (id)routeWithRelationshipName:(NSString *)relationshipName objectClass:(Class)objectClass pathPattern:(NSString *)pathPattern method:(RKRequestMethod)method
|
||||
+ (instancetype)routeWithRelationshipName:(NSString *)relationshipName objectClass:(Class)objectClass pathPattern:(NSString *)pathPattern method:(RKRequestMethod)method
|
||||
{
|
||||
NSParameterAssert(relationshipName);
|
||||
NSParameterAssert(objectClass);
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
@param baseURL The base URL with which to initialize the receiver.
|
||||
@return The receiver, initialized with the given base URL.
|
||||
*/
|
||||
- (id)initWithBaseURL:(NSURL *)baseURL;
|
||||
- (instancetype)initWithBaseURL:(NSURL *)baseURL;
|
||||
|
||||
///----------------------
|
||||
/// @name Generating URLs
|
||||
|
||||
@@ -55,6 +55,6 @@
|
||||
@param destinationKeyPath The key path on the destination object on which to set the mapped data.
|
||||
@return A newly created attribute mapping object that is ready to be added to an object mapping.
|
||||
*/
|
||||
+ (RKAttributeMapping *)attributeMappingFromKeyPath:(NSString *)sourceKeyPath toKeyPath:(NSString *)destinationKeyPath;
|
||||
+ (instancetype)attributeMappingFromKeyPath:(NSString *)sourceKeyPath toKeyPath:(NSString *)destinationKeyPath;
|
||||
|
||||
@end
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
@implementation RKAttributeMapping
|
||||
|
||||
+ (RKAttributeMapping *)attributeMappingFromKeyPath:(NSString *)sourceKeyPath toKeyPath:(NSString *)destinationKeyPath
|
||||
+ (instancetype)attributeMappingFromKeyPath:(NSString *)sourceKeyPath toKeyPath:(NSString *)destinationKeyPath
|
||||
{
|
||||
NSParameterAssert(sourceKeyPath);
|
||||
NSParameterAssert(destinationKeyPath);
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
@param mappingsDictionary An `NSDictionary` wherein the keys are mappable key paths in `object` and the values are `RKMapping` objects specifying how the representations at its key path are to be mapped.
|
||||
@return The receiver, initialized with the given object and and dictionary of key paths to mappings.
|
||||
*/
|
||||
- (id)initWithRepresentation:(id)representation mappingsDictionary:(NSDictionary *)mappingsDictionary;
|
||||
- (instancetype)initWithRepresentation:(id)representation mappingsDictionary:(NSDictionary *)mappingsDictionary;
|
||||
|
||||
///------------------------------------------
|
||||
/// @name Accessing Mapping Result and Errors
|
||||
|
||||
@@ -147,7 +147,7 @@
|
||||
@param objectOrDynamicMapping An instance of `RKObjectMapping` or `RKDynamicMapping` defining how the mapping is to be performed.
|
||||
@return The receiver, initialized with a source object, a destination object, and a mapping.
|
||||
*/
|
||||
- (id)initWithSourceObject:(id)sourceObject destinationObject:(id)destinationObject mapping:(RKMapping *)objectOrDynamicMapping;
|
||||
- (instancetype)initWithSourceObject:(id)sourceObject destinationObject:(id)destinationObject mapping:(RKMapping *)objectOrDynamicMapping;
|
||||
|
||||
///--------------------------------------
|
||||
/// @name Accessing Mapping Configuration
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
@param dictionary A dictionary wherein the keys represent mapped key paths and the values represent the objects mapped at those key paths. Cannot be nil.
|
||||
@return The receiver, initialized with the given dictionary.
|
||||
*/
|
||||
- (id)initWithDictionary:(NSDictionary *)dictionary;
|
||||
- (instancetype)initWithDictionary:(NSDictionary *)dictionary;
|
||||
|
||||
///----------------------------------------
|
||||
/// @name Retrieving Result Representations
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
@param objectClass The class that the mapping targets.
|
||||
@return A new mapping object.
|
||||
*/
|
||||
+ (id)mappingForClass:(Class)objectClass;
|
||||
+ (instancetype)mappingForClass:(Class)objectClass;
|
||||
|
||||
/**
|
||||
Initializes the receiver with a given object class. This is the designated initializer.
|
||||
@@ -83,7 +83,7 @@
|
||||
@param objectClass The class that the mapping targets. Cannot be `nil`.
|
||||
@return The receiver, initialized with the given class.
|
||||
*/
|
||||
- (id)initWithClass:(Class)objectClass;
|
||||
- (instancetype)initWithClass:(Class)objectClass;
|
||||
|
||||
/**
|
||||
Returns an object mapping with an `objectClass` of `NSMutableDictionary`.
|
||||
@@ -94,7 +94,7 @@
|
||||
@see `RKObjectParameterization`
|
||||
@see `RKObjectManager`
|
||||
*/
|
||||
+ (id)requestMapping;
|
||||
+ (instancetype)requestMapping;
|
||||
|
||||
///---------------------------------
|
||||
/// @name Managing Property Mappings
|
||||
@@ -298,7 +298,7 @@
|
||||
quickly generate a corresponding serialization mapping from a configured object mapping. The inverse
|
||||
mapping will have the source and destination keyPaths swapped for all attribute and relationship mappings.
|
||||
*/
|
||||
- (RKObjectMapping *)inverseMapping;
|
||||
- (instancetype)inverseMapping;
|
||||
|
||||
///---------------------------------------------------
|
||||
/// @name Obtaining Information About the Target Class
|
||||
@@ -313,7 +313,6 @@
|
||||
@return The class of the property.
|
||||
*/
|
||||
- (Class)classForProperty:(NSString *)propertyName;
|
||||
// TODO: Can I eliminate this and just use classForKeyPath:????
|
||||
|
||||
/**
|
||||
Returns the class of the attribute or relationship property of the target `objectClass` at the given key path.
|
||||
|
||||
@@ -51,12 +51,12 @@ static RKSourceToDesinationKeyTransformationBlock defaultSourceToDestinationKeyT
|
||||
|
||||
@implementation RKObjectMapping
|
||||
|
||||
+ (id)mappingForClass:(Class)objectClass
|
||||
+ (instancetype)mappingForClass:(Class)objectClass
|
||||
{
|
||||
return [[self alloc] initWithClass:objectClass];
|
||||
}
|
||||
|
||||
+ (id)requestMapping
|
||||
+ (instancetype)requestMapping
|
||||
{
|
||||
return [self mappingForClass:[NSMutableDictionary class]];
|
||||
}
|
||||
@@ -264,7 +264,7 @@ static RKSourceToDesinationKeyTransformationBlock defaultSourceToDestinationKeyT
|
||||
}
|
||||
}
|
||||
|
||||
- (RKObjectMapping *)inverseMappingAtDepth:(NSInteger)depth
|
||||
- (instancetype)inverseMappingAtDepth:(NSInteger)depth
|
||||
{
|
||||
NSAssert(depth < RKObjectMappingMaximumInverseMappingRecursionDepth, @"Exceeded max recursion level in inverseMapping. This is likely due to a loop in the serialization graph. To break this loop, specify one-way relationships by setting serialize to NO in mapKeyPath:toRelationship:withObjectMapping:serialize:");
|
||||
RKObjectMapping *inverseMapping = [RKObjectMapping mappingForClass:[NSMutableDictionary class]];
|
||||
@@ -284,7 +284,7 @@ static RKSourceToDesinationKeyTransformationBlock defaultSourceToDestinationKeyT
|
||||
return inverseMapping;
|
||||
}
|
||||
|
||||
- (RKObjectMapping *)inverseMapping
|
||||
- (instancetype)inverseMapping
|
||||
{
|
||||
return [self inverseMappingAtDepth:0];
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
@param destinationKeyPath The key path on the destination object to set the object mapped results.
|
||||
@param mapping A mapping object describing how to map the data retrieved from `sourceKeyPath` that is to be set on `destinationKeyPath`.
|
||||
*/
|
||||
+ (RKRelationshipMapping *)relationshipMappingFromKeyPath:(NSString *)sourceKeyPath toKeyPath:(NSString *)destinationKeyPath withMapping:(RKMapping *)mapping;
|
||||
+ (instancetype)relationshipMappingFromKeyPath:(NSString *)sourceKeyPath toKeyPath:(NSString *)destinationKeyPath withMapping:(RKMapping *)mapping;
|
||||
|
||||
///----------------------------------------
|
||||
/// @name Accessing the Destination Mapping
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
@implementation RKRelationshipMapping
|
||||
|
||||
+ (RKRelationshipMapping *)relationshipMappingFromKeyPath:(NSString *)sourceKeyPath toKeyPath:(NSString *)destinationKeyPath withMapping:(RKMapping *)mapping
|
||||
+ (instancetype)relationshipMappingFromKeyPath:(NSString *)sourceKeyPath toKeyPath:(NSString *)destinationKeyPath withMapping:(RKMapping *)mapping
|
||||
{
|
||||
RKRelationshipMapping *relationshipMapping = [self new];
|
||||
relationshipMapping.sourceKeyPath = sourceKeyPath;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
@return An autoreleased `RKDotNetDateFormatter` object
|
||||
@see dotNetDateFormatter
|
||||
*/
|
||||
+ (RKDotNetDateFormatter *)dotNetDateFormatterWithTimeZone:(NSTimeZone *)timeZone;
|
||||
+ (instancetype)dotNetDateFormatterWithTimeZone:(NSTimeZone *)timeZone;
|
||||
|
||||
/**
|
||||
Returns an `NSDate` object from an ASP.NET style date string respresentation, as seen in JSON.
|
||||
|
||||
@@ -33,9 +33,9 @@ static NSTimeInterval RKDotNetDateFormatterMillisecondsFromSeconds(NSTimeInterva
|
||||
|
||||
@implementation RKDotNetDateFormatter
|
||||
|
||||
+ (RKDotNetDateFormatter *)dotNetDateFormatterWithTimeZone:(NSTimeZone *)newTimeZone
|
||||
+ (instancetype)dotNetDateFormatterWithTimeZone:(NSTimeZone *)newTimeZone
|
||||
{
|
||||
RKDotNetDateFormatter *formatter = [[RKDotNetDateFormatter alloc] init];
|
||||
RKDotNetDateFormatter *formatter = [self new];
|
||||
if (newTimeZone) formatter.timeZone = newTimeZone;
|
||||
return formatter;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
@param pathString The string to evaluate and parse, such as `/districts/tx/upper/?apikey=GC5512354`
|
||||
@return An instantiated `RKPathMatcher` without an established pattern.
|
||||
*/
|
||||
+ (RKPathMatcher *)pathMatcherWithPath:(NSString *)pathString;
|
||||
+ (instancetype)pathMatcherWithPath:(NSString *)pathString;
|
||||
|
||||
/**
|
||||
Determines if the path string matches the provided pattern, and yields a dictionary with the resulting matched key/value pairs. Use of this method should be preceded by `pathMatcherWithPath:` Pattern strings should include encoded parameter keys, delimited by a single colon at the beginning of the key name.
|
||||
@@ -74,7 +74,7 @@
|
||||
@param patternString The pattern to use for evaluating, such as `/:entityName/:stateID/:chamber/`
|
||||
@return An instantiated `RKPathMatcher` with an established pattern.
|
||||
*/
|
||||
+ (RKPathMatcher *)pathMatcherWithPattern:(NSString *)patternString;
|
||||
+ (instancetype)pathMatcherWithPattern:(NSString *)patternString;
|
||||
|
||||
/**
|
||||
Determines if the given path string matches a pattern, and yields a dictionary with the resulting matched key/value pairs. Use of this method should be preceded by `pathMatcherWithPattern:`.
|
||||
|
||||
@@ -59,18 +59,18 @@ static NSString *RKEncodeURLString(NSString *unencodedString)
|
||||
return copy;
|
||||
}
|
||||
|
||||
+ (RKPathMatcher *)pathMatcherWithPattern:(NSString *)patternString
|
||||
+ (instancetype)pathMatcherWithPattern:(NSString *)patternString
|
||||
{
|
||||
NSAssert(patternString != NULL, @"Pattern string must not be empty in order to perform pattern matching.");
|
||||
RKPathMatcher *matcher = [[RKPathMatcher alloc] init];
|
||||
RKPathMatcher *matcher = [self new];
|
||||
matcher.socPattern = [SOCPattern patternWithString:patternString];
|
||||
matcher.patternString = patternString;
|
||||
return matcher;
|
||||
}
|
||||
|
||||
+ (RKPathMatcher *)pathMatcherWithPath:(NSString *)pathString
|
||||
+ (instancetype)pathMatcherWithPath:(NSString *)pathString
|
||||
{
|
||||
RKPathMatcher *matcher = [[RKPathMatcher alloc] init];
|
||||
RKPathMatcher *matcher = [self new];
|
||||
matcher.sourcePath = pathString;
|
||||
matcher.rootPath = pathString;
|
||||
return matcher;
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
@param value The value that is expected to be set for the relationship when the connection is established.
|
||||
@return A newly constructed connection expectation, initialized with the given relationship name, attributes dictionary, and expected value.
|
||||
*/
|
||||
+ (id)expectationWithRelationshipName:(NSString *)relationshipName attributes:(NSDictionary *)attributes value:(id)value;
|
||||
+ (instancetype)expectationWithRelationshipName:(NSString *)relationshipName attributes:(NSDictionary *)attributes value:(id)value;
|
||||
|
||||
/**
|
||||
Initializes the receiver with the given relationship name, attributes dictionary, and value.
|
||||
@@ -50,7 +50,7 @@
|
||||
@param value The value that is expected to be set for the relationship when the connection is established.
|
||||
@return The receiver, initialized with the given relationship name, attributes dictionary, and expected value.
|
||||
*/
|
||||
- (id)initWithRelationshipName:(NSString *)relationshipName attributes:(NSDictionary *)attributes value:(id)value;
|
||||
- (instancetype)initWithRelationshipName:(NSString *)relationshipName attributes:(NSDictionary *)attributes value:(id)value;
|
||||
|
||||
///------------------------------------
|
||||
/// @name Accessing Expectation Details
|
||||
|
||||
@@ -30,12 +30,12 @@
|
||||
|
||||
@implementation RKConnectionTestExpectation
|
||||
|
||||
+ (id)expectationWithRelationshipName:(NSString *)relationshipName attributes:(NSDictionary *)attributes value:(id)value
|
||||
+ (instancetype)expectationWithRelationshipName:(NSString *)relationshipName attributes:(NSDictionary *)attributes value:(id)value
|
||||
{
|
||||
return [[self alloc] initWithRelationshipName:relationshipName attributes:attributes value:value];
|
||||
}
|
||||
|
||||
- (id)initWithRelationshipName:(NSString *)relationshipName attributes:(NSDictionary *)attributes value:(id)value
|
||||
- (instancetype)initWithRelationshipName:(NSString *)relationshipName attributes:(NSDictionary *)attributes value:(id)value
|
||||
{
|
||||
NSParameterAssert(relationshipName);
|
||||
NSAssert(value == nil ||
|
||||
|
||||
@@ -95,7 +95,7 @@ extern NSString * const RKMappingTestExpectationErrorKey;
|
||||
@param destinationObject The destionation object being to.
|
||||
@return A new mapping test object for a mapping, a source object and a destination object.
|
||||
*/
|
||||
+ (RKMappingTest *)testForMapping:(RKMapping *)mapping sourceObject:(id)sourceObject destinationObject:(id)destinationObject;
|
||||
+ (instancetype)testForMapping:(RKMapping *)mapping sourceObject:(id)sourceObject destinationObject:(id)destinationObject;
|
||||
|
||||
/**
|
||||
Initializes the receiver with a given object mapping, source object, and destination object.
|
||||
@@ -105,7 +105,7 @@ extern NSString * const RKMappingTestExpectationErrorKey;
|
||||
@param destinationObject The destionation object being to.
|
||||
@return The receiver, initialized with mapping, sourceObject and destinationObject.
|
||||
*/
|
||||
- (id)initWithMapping:(RKMapping *)mapping sourceObject:(id)sourceObject destinationObject:(id)destinationObject;
|
||||
- (instancetype)initWithMapping:(RKMapping *)mapping sourceObject:(id)sourceObject destinationObject:(id)destinationObject;
|
||||
|
||||
///----------------------------
|
||||
/// @name Managing Expectations
|
||||
|
||||
@@ -130,7 +130,7 @@ NSString * const RKMappingTestVerificationFailureException = @"RKMappingTestVeri
|
||||
|
||||
@implementation RKMappingTest
|
||||
|
||||
+ (RKMappingTest *)testForMapping:(RKMapping *)mapping sourceObject:(id)sourceObject destinationObject:(id)destinationObject
|
||||
+ (instancetype)testForMapping:(RKMapping *)mapping sourceObject:(id)sourceObject destinationObject:(id)destinationObject
|
||||
{
|
||||
return [[self alloc] initWithMapping:mapping sourceObject:sourceObject destinationObject:destinationObject];
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ typedef BOOL (^RKMappingTestExpectationEvaluationBlock)(RKPropertyMappingTestExp
|
||||
@param destinationKeyPath A key path on the destination object that should be mapped onto.
|
||||
@return An expectation specifying that sourceKeyPath should be mapped to destinationKeyPath.
|
||||
*/
|
||||
+ (RKPropertyMappingTestExpectation *)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath;
|
||||
+ (instancetype)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath;
|
||||
|
||||
/**
|
||||
Creates and returns a new expectation specifying that a key path in a source object should be mapped to another key path on a destination object with a given value.
|
||||
@@ -58,7 +58,7 @@ typedef BOOL (^RKMappingTestExpectationEvaluationBlock)(RKPropertyMappingTestExp
|
||||
@param value The value that is expected to be assigned to the destination object at destinationKeyPath.
|
||||
@return An expectation specifying that sourceKeyPath should be mapped to destinationKeyPath with value.
|
||||
*/
|
||||
+ (RKPropertyMappingTestExpectation *)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath value:(id)value;
|
||||
+ (instancetype)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath value:(id)value;
|
||||
|
||||
/**
|
||||
Creates and returns a new expectation specifying that a key path in a source object should be mapped to another key path on a destinaton object and that the attribute mapping and value should evaluate to true with a given block.
|
||||
@@ -68,7 +68,7 @@ typedef BOOL (^RKMappingTestExpectationEvaluationBlock)(RKPropertyMappingTestExp
|
||||
@param evaluationBlock A block with which to evaluate the success of the mapping.
|
||||
@return An expectation specifying that sourceKeyPath should be mapped to destinationKeyPath with value.
|
||||
*/
|
||||
+ (RKPropertyMappingTestExpectation *)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath evaluationBlock:(RKMappingTestExpectationEvaluationBlock)evaluationBlock;
|
||||
+ (instancetype)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath evaluationBlock:(RKMappingTestExpectationEvaluationBlock)evaluationBlock;
|
||||
|
||||
/**
|
||||
Creates and returns a new expectation specifying that a key path in a source object should be mapped to another key path on a destinaton object using a specific object mapping for the relationship.
|
||||
@@ -78,7 +78,7 @@ typedef BOOL (^RKMappingTestExpectationEvaluationBlock)(RKPropertyMappingTestExp
|
||||
@param mapping An object mapping that is expected to be used for mapping the nested relationship.
|
||||
@return An expectation specifying that sourceKeyPath should be mapped to destinationKeyPath using a specific object mapping.
|
||||
*/
|
||||
+ (RKPropertyMappingTestExpectation *)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath mapping:(RKMapping *)mapping;
|
||||
+ (instancetype)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath mapping:(RKMapping *)mapping;
|
||||
|
||||
///-------------------------
|
||||
/// @name Expectation Values
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
@implementation RKPropertyMappingTestExpectation
|
||||
|
||||
+ (RKPropertyMappingTestExpectation *)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath
|
||||
+ (instancetype)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath
|
||||
{
|
||||
RKPropertyMappingTestExpectation *expectation = [self new];
|
||||
expectation.sourceKeyPath = sourceKeyPath;
|
||||
@@ -40,7 +40,7 @@
|
||||
return expectation;
|
||||
}
|
||||
|
||||
+ (RKPropertyMappingTestExpectation *)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath value:(id)value
|
||||
+ (instancetype)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath value:(id)value
|
||||
{
|
||||
RKPropertyMappingTestExpectation *expectation = [self new];
|
||||
expectation.sourceKeyPath = sourceKeyPath;
|
||||
@@ -50,7 +50,7 @@
|
||||
return expectation;
|
||||
}
|
||||
|
||||
+ (RKPropertyMappingTestExpectation *)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath evaluationBlock:(RKMappingTestExpectationEvaluationBlock)evaluationBlock
|
||||
+ (instancetype)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath evaluationBlock:(RKMappingTestExpectationEvaluationBlock)evaluationBlock
|
||||
{
|
||||
RKPropertyMappingTestExpectation *expectation = [self new];
|
||||
expectation.sourceKeyPath = sourceKeyPath;
|
||||
@@ -60,7 +60,7 @@
|
||||
return expectation;
|
||||
}
|
||||
|
||||
+ (RKPropertyMappingTestExpectation *)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath mapping:(RKMapping *)mapping
|
||||
+ (instancetype)expectationWithSourceKeyPath:(NSString *)sourceKeyPath destinationKeyPath:(NSString *)destinationKeyPath mapping:(RKMapping *)mapping
|
||||
{
|
||||
RKPropertyMappingTestExpectation *expectation = [self new];
|
||||
expectation.sourceKeyPath = sourceKeyPath;
|
||||
|
||||
@@ -434,7 +434,7 @@
|
||||
RKObjectMapping *childMapping = [RKObjectMapping mappingForClass:[RKTestUser class]];
|
||||
[childMapping addAttributeMappingsFromArray:@[@"name"]];
|
||||
|
||||
RKEntityMapping *parentMapping = [RKObjectMapping mappingForClass:[RKTestUser class]];
|
||||
RKObjectMapping *parentMapping = [RKObjectMapping mappingForClass:[RKTestUser class]];
|
||||
[parentMapping addAttributeMappingsFromArray:@[@"name"]];
|
||||
[parentMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"children" toKeyPath:@"friends" withMapping:childMapping]];
|
||||
NSDictionary *mappingsDictionary = @{ @"parents": parentMapping };
|
||||
|
||||
Reference in New Issue
Block a user