Inherits from NSObject
Declared in RKObjectMappingOperation.h
RKObjectMappingOperation.m

Overview

Instances of RKObjectMappingOperation perform transformation between object representations according to the rules express 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

  •   sourceObject

    A dictionary of mappable elements containing simple values or nested object structures.

    property
  •   destinationObject

    The target object for this operation. Mappable values in elements will be applied to object using key-value coding.

    property
  •   objectMapping

    The object mapping defining how values contained in the source object should be transformed to the destination object via key-value coding

    property
  •   delegate

    The delegate to inform of interesting events during the mapping operation

    property
  •   queue

    An operation queue for deferring portions of the mapping process until later

    property
  • + mappingOperationFromObject:toObject:withMapping:

    Creates and returns a new mapping operation configured to transform the object representation in a source object to a new destination object according to an object mapping definition.

  • – initWithSourceObject:destinationObject:mapping:

    Initializes the receiver with a source and destination objects and an object mapping definition for performing a 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

delegate

The delegate to inform of interesting events during the mapping operation

@property (nonatomic, assign) id<> delegate

Declared In

RKObjectMappingOperation.h

destinationObject

The target object for this operation. Mappable values in elements will be applied to object using key-value coding.

@property (nonatomic, readonly) id destinationObject

Declared In

RKObjectMappingOperation.h

objectMapping

The object mapping defining how values contained in the source object should be transformed to the destination object via key-value coding

@property (nonatomic, readonly) RKObjectMapping *objectMapping

Declared In

RKObjectMappingOperation.h

queue

An operation queue for deferring portions of the mapping process until later

@property (nonatomic, retain) RKMappingOperationQueue *queue

Discussion

Defaults to nil. If this mapping operation was configured by an instance of RKObjectMapper, then an instance of the operation queue will be configured and assigned for use. If the queue is nil, the mapping operation will perform all its operations within the body of performMapping. If a queue is present, it may elect to defer portions of the mapping operation using the queue.

Declared In

RKObjectMappingOperation.h

sourceObject

A dictionary of mappable elements containing simple values or nested object structures.

@property (nonatomic, readonly) id sourceObject

Declared In

RKObjectMappingOperation.h

Class Methods

mappingOperationFromObject:toObject:withMapping:

Creates and returns a new mapping operation configured to transform the object representation in a source object to a new destination object according to an object mapping definition.

+ (id)mappingOperationFromObject:(id)sourceObject toObject:(id)destinationObject withMapping:(RKObjectMappingDefinition *)mapping

Parameters

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 will be constructed during the mapping.

mapping

An instance of RKObjectMapping or RKDynamicObjectMapping defining how the mapping is to be performed.

Return Value

An instance of RKObjectMappingOperation or RKManagedObjectMappingOperation for performing the mapping.

Discussion

Note that if Core Data support is available, an instance of RKManagedObjectMappingOperation may be returned.

Declared In

RKObjectMappingOperation.h

Instance Methods

initWithSourceObject:destinationObject:mapping:

Initializes the receiver with a source and destination objects and an object mapping definition for performing a mapping.

- (id)initWithSourceObject:(id)sourceObject destinationObject:(id)destinationObject mapping:(RKObjectMappingDefinition *)mapping

Parameters

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 will be constructed during the mapping.

mapping

An instance of RKObjectMapping or RKDynamicObjectMapping defining how the mapping is to be performed.

Return Value

The receiver, initialized with a source object, a destination object, and a mapping.

Declared In

RKObjectMappingOperation.h

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

- (BOOL)performMapping:(NSError **)error

Parameters

error

A pointer to an NSError reference to capture any error that occurs during the mapping. May be nil.

Return Value

A Boolean value indicating if the mapping operation was successful.

Declared In

RKObjectMappingOperation.h