mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-04-01 22:42:51 +08:00
* Removed RestKit from inheritance hierarchy * Mappings are implemented as concrete classes * Mapper is much more flexible & powerful * Much more robust error handling * Serialization is reimplemented as an object mapping operation * Added ability to serialize to JSON natively * Reworked Core Data integration * Simplified the codebase substantially
55 lines
1.6 KiB
Objective-C
55 lines
1.6 KiB
Objective-C
//
|
|
// RKObjectMappingProvider.h
|
|
// RestKit
|
|
//
|
|
// Created by Jeremy Ellison on 5/6/11.
|
|
// Copyright 2011 Two Toasters. All rights reserved.
|
|
//
|
|
|
|
#import "RKObjectMapping.h"
|
|
|
|
/**
|
|
Responsible for providing object mappings to an instance of the object mapper
|
|
by evaluating the current keyPath being operated on
|
|
*/
|
|
@interface RKObjectMappingProvider : NSObject {
|
|
NSMutableDictionary* _mappings;
|
|
NSMutableDictionary* _serializationMappings;
|
|
}
|
|
|
|
/**
|
|
Set a mapping for a keypath that comes back in your payload
|
|
*/
|
|
- (void)setMapping:(RKObjectMapping*)mapping forKeyPath:(NSString*)keyPath;
|
|
|
|
/**
|
|
Returns the object mapping to use for mapping the specified keyPath into an object graph
|
|
*/
|
|
- (RKObjectMapping*)objectMappingForKeyPath:(NSString*)keyPath;
|
|
|
|
/**
|
|
Set a mapping to serialize objects of a specific class into a representation
|
|
suitable for transport over HTTP. Used by the object manager during postObject: and putObject:
|
|
*/
|
|
- (void)setSerializationMapping:(RKObjectMapping *)mapping forClass:(Class)objectClass;
|
|
|
|
/**
|
|
returns the serialization mapping for a specific object class
|
|
which has been previously registered.
|
|
*/
|
|
- (RKObjectMapping*)serializationMappingForClass:(Class)objectClass;
|
|
|
|
/**
|
|
returns _mappings
|
|
*/
|
|
- (NSDictionary*)objectMappingsByKeyPath;
|
|
|
|
/**
|
|
Registers an object mapping as being rooted at a specific keyPath. The keyPath will be registered
|
|
and an inverse mapping for the object will be generated and used for serialization.
|
|
*/
|
|
// TODO: Are we happy with this design/method signature?
|
|
- (void)registerMapping:(RKObjectMapping*)objectMapping withRootKeyPath:(NSString*)keyPath;
|
|
|
|
@end
|