RKMappingOperation Class Reference
| Inherits from | NSOperation |
| Declared in | RKMappingOperation.h |
Overview
Instances of RKMappingOperation perform transformation between object representations according to the rules expressed in RKObjectMapping objects. Mapping operations provide the foundation for the RestKit object mapping engine and perform the work of inspecting the attributes and relationships of a source object and determining how to map them into new representations on a destination object.
Tasks
Initializing a Mapping Operation
-
– initWithSourceObject:destinationObject:mapping:Initializes the receiver with a source object, a destination object and an object mapping with which to perform an object mapping.
Accessing Mapping Configuration
-
sourceObjectA dictionary of mappable elements containing simple values or nested object structures.
property -
destinationObjectThe target object for this operation. Mappable values in elements will be applied to object using key-value coding.
property -
mappingThe mapping defining how values contained in the source object should be transformed to the destination object via key-value coding.
property
Configuring Delegate and Data Source
-
delegateThe delegate to inform of interesting events during the mapping operation lifecycle.
property -
dataSourceThe data source is responsible for providing the mapping operation with an appropriate target object for mapping when the
propertydestinationObjectisnil. -
errorThe error, if any, that occurred during the execution of the mapping operation.
property
Performing Mapping
-
– performMapping:Process all mappable values from the mappable dictionary and assign them to the target object according to the rules expressed in the object mapping definition
Properties
dataSource
The data source is responsible for providing the mapping operation with an appropriate target object for mapping when the destinationObject is nil.
@property (nonatomic, weak) id<RKMappingOperationDataSource> dataSourceDeclared In
RKMappingOperation.hdelegate
The delegate to inform of interesting events during the mapping operation lifecycle.
@property (nonatomic, weak) id<RKMappingOperationDelegate> delegateDeclared In
RKMappingOperation.hdestinationObject
The target object for this operation. Mappable values in elements will be applied to object using key-value coding.
@property (nonatomic, strong, readonly) id destinationObjectDeclared In
RKMappingOperation.herror
The error, if any, that occurred during the execution of the mapping operation.
@property (nonatomic, strong, readonly) NSError *errorDeclared In
RKMappingOperation.hmapping
The mapping defining how values contained in the source object should be transformed to the destination object via key-value coding.
@property (nonatomic, strong, readonly) RKMapping *mappingDiscussion
Will either be an instance of RKObjectMapping or RKDynamicMapping.
Declared In
RKMappingOperation.hInstance Methods
initWithSourceObject:destinationObject:mapping:
Initializes the receiver with a source object, a destination object and an object mapping with which to perform an object mapping.
- (id)initWithSourceObject:(id)sourceObject destinationObject:(id)destinationObject mapping:(RKMapping *)objectOrDynamicMappingParameters
- sourceObject
The source object to be mapped. Cannot be
nil.
- destinationObject
The destination object the results are to be mapped onto. May be
nil, in which case a new object target object will be obtained from thedataSource.
- objectOrDynamicMapping
An instance of
RKObjectMappingorRKDynamicMappingdefining how the mapping is to be performed.
Return Value
The receiver, initialized with a source object, a destination object, and a mapping.
Declared In
RKMappingOperation.hperformMapping:
Process all mappable values from the mappable dictionary and assign them to the target object according to the rules expressed in the object mapping definition
- (BOOL)performMapping:(NSError **)errorParameters
Return Value
A Boolean value indicating if the mapping operation was successful.
Declared In
RKMappingOperation.h