RKObjectMapper Class Reference
Inherits from | NSObject |
Declared in | RKObjectMapper.h RKObjectMapper.m |
Overview
The policy to use when a payload returned from the remote service does not contain values for all elements specified in the elementToPropertyMappings definition.
When the ignore policy (RKIgnoreMissingElementMappingPolicy) is selected, the mapper will leave the current value assigned to the corresponding object property as is.
When the set nil policy (RKSetNilForMissingElementMappingPolicy) is selected, the mapper will set the value for the mapped property target to nil to clear its value.
Tasks
-
format
The format the mapper is using
property -
missingElementMappingPolicy
The policy to use when the mapper encounters a payload that does not have property values specified for all elements. See the description about the available mapping policies above for more information.
property -
dateFormats
An array of date format strings to attempt to parse mapped date properties with
property -
remoteTimeZone
The time zone of the remote system. Date strings pulled from the remote source will be considered to be local to this time zone when mapping.
property -
localTimeZone
The target time zone to map dates to.
property -
– registerClass:forElementNamed:
Register a mapping for a given class for an XML element with the given tag name will blow up if the class does not respond to elementToPropertyMappings and elementToRelationshipMappings
-
– mapFromString:
Digests a string into an object graph and returns mapped model objects from the objects serialized in the string
-
– parseErrorFromString:
Digests a string (such as an error response body) in to an NSError. It should only be called for a string you know contains an error.
-
– mapObject:fromString:
Sets the properties and relationships serialized in the string into the model instance provided
-
– mapObject:fromDictionary:
Sets the properties and relationships serialized in the dictionary into the model instance provided
-
– mapObjectFromDictionary:
Returns mapped model(s) from the data serialized in the dictionary into the model instance provided
-
– mapObjectsFromArrayOfDictionaries:
Constructs an array of mapped model objects from an array of dictionaries containing serialized objects
-
– mapFromString:toClass:keyPath:
Map the objects in a given payload string to a particular object class, optionally filtering the parsed result set via a keyPath before mapping the results.
-
– mapObjectFromDictionary:toClass:
Map a dictionary of elements to an instance of a particular class
-
– mapObjectsFromArrayOfDictionaries:toClass:
Map an array of object dictionary representations to instances of a particular object class
-
– parseString:
Parse a string using the appropriate parser and return the results
Properties
dateFormats
An array of date format strings to attempt to parse mapped date properties with
@property (nonatomic, retain) NSArray *dateFormats
Discussion
Initialized with a default pair of timestamp and date strings suitable for parseing time and date objects returned from Rails applications
Declared In
RKObjectMapper.h
format
The format the mapper is using
@property (nonatomic, assign) RKMappingFormat format
Declared In
RKObjectMapper.h
localTimeZone
The target time zone to map dates to.
@property (nonatomic, retain) NSTimeZone *localTimeZone
Discussion
Defaults to the local time zone
Declared In
RKObjectMapper.h
missingElementMappingPolicy
The policy to use when the mapper encounters a payload that does not have property values specified for all elements. See the description about the available mapping policies above for more information.
@property (nonatomic, assign) RKMissingElementMappingPolicy missingElementMappingPolicy
Discussion
@default RKIgnoreMissingElementMappingPolicy
Declared In
RKObjectMapper.h
Instance Methods
mapFromString:
Digests a string into an object graph and returns mapped model objects from the objects serialized in the string
- (id)mapFromString:(NSString *)string
Declared In
RKObjectMapper.h
mapFromString:toClass:keyPath:
Map the objects in a given payload string to a particular object class, optionally filtering the parsed result set via a keyPath before mapping the results.
- (id)mapFromString:(NSString *)string toClass:(Class<RKObjectMappable>)objectClass keyPath:(NSString *)keyPath
Declared In
RKObjectMapper.h
mapObject:fromDictionary:
Sets the properties and relationships serialized in the dictionary into the model instance provided
- (void)mapObject:(NSObject<RKObjectMappable> *)object fromDictionary:(NSDictionary *)dictionary
Declared In
RKObjectMapper.h
mapObject:fromString:
Sets the properties and relationships serialized in the string into the model instance provided
- (void)mapObject:(id)model fromString:(NSString *)string
Declared In
RKObjectMapper.h
mapObjectFromDictionary:
Returns mapped model(s) from the data serialized in the dictionary into the model instance provided
- (NSObject<RKObjectMappable> *)mapObjectFromDictionary:(NSDictionary *)dictionary
Declared In
RKObjectMapper.h
mapObjectFromDictionary:toClass:
Map a dictionary of elements to an instance of a particular class
- (id)mapObjectFromDictionary:(NSDictionary *)dictionary toClass:(Class)objectClass
Declared In
RKObjectMapper.h
mapObjectsFromArrayOfDictionaries:
Constructs an array of mapped model objects from an array of dictionaries containing serialized objects
- (NSArray *)mapObjectsFromArrayOfDictionaries:(NSArray *)array
Declared In
RKObjectMapper.h
mapObjectsFromArrayOfDictionaries:toClass:
Map an array of object dictionary representations to instances of a particular object class
- (NSArray *)mapObjectsFromArrayOfDictionaries:(NSArray *)array toClass:(Class<RKObjectMappable>)objectClass
Declared In
RKObjectMapper.h
parseErrorFromString:
Digests a string (such as an error response body) in to an NSError. It should only be called for a string you know contains an error.
- (NSError *)parseErrorFromString:(NSString *)string
Declared In
RKObjectMapper.h
parseString:
Parse a string using the appropriate parser and return the results
- (id)parseString:(NSString *)string
Declared In
RKObjectMapper.h
registerClass:forElementNamed:
Register a mapping for a given class for an XML element with the given tag name will blow up if the class does not respond to elementToPropertyMappings and elementToRelationshipMappings
- (void)registerClass:(Class<RKObjectMappable>)aClass forElementNamed:(NSString *)elementName
Declared In
RKObjectMapper.h