mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-24 04:46:01 +08:00
Docs cleanup
This commit is contained in:
@@ -64,28 +64,6 @@
|
||||
*/
|
||||
- (NSUInteger)countForEntityForName:(NSString *)entityName predicate:(NSPredicate *)predicate error:(NSError **)error;
|
||||
|
||||
/////----------------------------------------------
|
||||
///// @name Fetching Managed Objects by Primary Key
|
||||
/////----------------------------------------------
|
||||
//
|
||||
///**
|
||||
// Fetches a single managed object for the given entity with the given value for the primary key attribute in the receiver.
|
||||
//
|
||||
// @param entity The entity of the managed object to be retrieved by primary key.
|
||||
// @param primaryKeyValue The value for the entity's primary key attribute.
|
||||
// @return The managed object with the primary key attribute equal to the given value or nil if none was found.
|
||||
// */
|
||||
//- (id)fetchObjectForEntity:(NSEntityDescription *)entity withValueForPrimaryKeyAttribute:(id)primaryKeyValue;
|
||||
//
|
||||
///**
|
||||
// Fetches a single managed object for the entity for the given name with the given value for the primary key attribute in the receiver.
|
||||
//
|
||||
// @param entityName The name of the entity of the managed object to be retrieved by primary key.
|
||||
// @param primaryKeyValue The value for the receiving entity's primary key attribute.
|
||||
// @return The managed object with the primary key attribute equal to the given value or nil if none was found.
|
||||
// */
|
||||
//- (id)fetchObjectForEntityForName:(NSString *)entityName withValueForPrimaryKeyAttribute:(id)primaryKeyValue;
|
||||
|
||||
///-------------------------------------------------
|
||||
/// @name Saving the Context to the Persistent Store
|
||||
///-------------------------------------------------
|
||||
|
||||
@@ -37,41 +37,6 @@
|
||||
return [self countForFetchRequest:fetchRequest error:error];
|
||||
}
|
||||
|
||||
//- (id)fetchObjectForEntity:(NSEntityDescription *)entity withValueForPrimaryKeyAttribute:(id)primaryKeyValue
|
||||
//{
|
||||
// NSPredicate *predicate = [entity predicateForPrimaryKeyAttributeWithValue:primaryKeyValue];
|
||||
// if (! predicate) {
|
||||
// RKLogWarning(@"Attempt to fetchObjectForEntity for entity with nil primaryKeyAttribute. Set the primaryKeyAttributeName and try again! %@", self);
|
||||
// return nil;
|
||||
// }
|
||||
//
|
||||
// NSFetchRequest *fetchRequest = [NSFetchRequest new];
|
||||
// fetchRequest.entity = entity;
|
||||
// fetchRequest.predicate = predicate;
|
||||
// fetchRequest.fetchLimit = 1;
|
||||
// __block NSError *error;
|
||||
// __block NSArray *objects;
|
||||
// [self performBlockAndWait:^{
|
||||
// objects = [self executeFetchRequest:fetchRequest error:&error];
|
||||
// }];
|
||||
// if (! objects) {
|
||||
// RKLogCoreDataError(error);
|
||||
// return nil;
|
||||
// }
|
||||
//
|
||||
// if ([objects count] == 1) {
|
||||
// return [objects objectAtIndex:0];
|
||||
// }
|
||||
//
|
||||
// return nil;
|
||||
//}
|
||||
//
|
||||
//- (id)fetchObjectForEntityForName:(NSString *)entityName withValueForPrimaryKeyAttribute:(id)primaryKeyValue
|
||||
//{
|
||||
// NSEntityDescription *entity = [NSEntityDescription entityForName:entityName inManagedObjectContext:self];
|
||||
// return [self fetchObjectForEntity:entity withValueForPrimaryKeyAttribute:primaryKeyValue];
|
||||
//}
|
||||
|
||||
- (BOOL)saveToPersistentStore:(NSError **)error
|
||||
{
|
||||
__block NSError *localError = nil;
|
||||
|
||||
@@ -9,58 +9,27 @@
|
||||
#import <CoreData/CoreData.h>
|
||||
|
||||
/**
|
||||
Objects implementing the RKManagedObjectCaching protocol can act as the cache
|
||||
strategy for RestKit managed object stores. The managed object cache is consulted
|
||||
when objects are retrieved from Core Data during object mapping operations and provide
|
||||
an opportunity to accelerate the mapping process by trading memory for speed.
|
||||
Objects implementing the `RKManagedObjectCaching` provide support for retrieving managed object matching a set of attributes using an opaque caching strategy. The objects retrieved are not required to be in any particular order, but must exactly match the attribute values requested.
|
||||
*/
|
||||
@protocol RKManagedObjectCaching <NSObject>
|
||||
|
||||
@required
|
||||
|
||||
///---------------------------------
|
||||
/// @name Retrieving Managed Objects
|
||||
///---------------------------------
|
||||
|
||||
// New API
|
||||
/**
|
||||
Returns all managed objects for a given entity with attributes whose names and values match the given dictionary in a given context.
|
||||
|
||||
@param entity The entity to retrieve managed objects for.
|
||||
@param attributeValues A dictionary specifying the attribute criteria for retrieving managed objects.
|
||||
@param managedObjectContext The context to fetch the matching objects in.
|
||||
*/
|
||||
- (NSArray *)managedObjectsWithEntity:(NSEntityDescription *)entity
|
||||
attributeValues:(NSDictionary *)attributeValues
|
||||
inManagedObjectContext:(NSManagedObjectContext *)managedObjectContext;
|
||||
|
||||
///------------------------------
|
||||
/// @name Finding Managed Objects
|
||||
///------------------------------
|
||||
|
||||
/**
|
||||
Retrieves a model object from the object store given a Core Data entity and
|
||||
the primary key attribute and value for the desired object.
|
||||
|
||||
@param entity The Core Data entity for the type of object to be retrieved from the cache.
|
||||
@param primaryKeyAttribute The name of the attribute that acts as the primary key for the entity.
|
||||
@param primaryKeyValue The value for the primary key attribute of the object to be retrieved from the cache.
|
||||
@param managedObjectContext The managed object context to be searched for a matching instance.
|
||||
@return A managed object that is an instance of the given entity with a primary key and value matching
|
||||
the specified parameters, or nil if no object was found.
|
||||
*/
|
||||
//- (NSManagedObject *)findInstanceOfEntity:(NSEntityDescription *)entity
|
||||
// withPrimaryKeyAttribute:(NSString *)primaryKeyAttribute
|
||||
// value:(id)primaryKeyValue
|
||||
// inManagedObjectContext:(NSManagedObjectContext *)managedObjectContext;
|
||||
|
||||
/**
|
||||
Retrieves an array of model objects from the object store given a Core Data entity and
|
||||
the primary key attribute and value for the desired object.
|
||||
|
||||
@param entity The Core Data entity for the type of object to be retrieved from the cache.
|
||||
@param primaryKeyAttribute The name of the attribute that acts as the primary key for the entity.
|
||||
@param primaryKeyValue The value for the primary key attribute of the object to be retrieved from the cache.
|
||||
@param managedObjectContext The managed object context to be searched for a matching instance.
|
||||
@return An array of managed objects that are instances of the given entity with a primary key and value matching
|
||||
the specified parameters, or nil if no object was found.
|
||||
*/
|
||||
//- (NSArray *)findInstancesOfEntity:(NSEntityDescription *)entity
|
||||
// withPrimaryKeyAttribute:(NSString *)primaryKeyAttribute
|
||||
// value:(id)primaryKeyValue
|
||||
// inManagedObjectContext:(NSManagedObjectContext *)managedObjectContext;
|
||||
|
||||
///---------------------------------------------------
|
||||
/// @name Handling Managed Object Change Notifications
|
||||
///---------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user