Inherits from NSObject
Declared in RKMappingResult.h

Overview

The RKMappingResult class represents the aggregate object mapping results returned by an RKMapperOperation object. The mapping result provides a thin interface on top of an NSDictionary and provides convenient interfaces for accessing the mapping results in various representations.

Tasks

Creating a Mapping Result

Retrieving Result Representations

  • – dictionary

    Returns a representation of the mapping result as a dictionary.

  • – firstObject

    Returns a representation of the mapping result as a single object by returning the first mapped value from the aggregate array of mapped objects.

  • – array

    Returns a representation of the mapping result as an array of objects.

  • – set

    Returns a representation of the mapping result as a set of objects.

Counting Entries

  • – count

    Returns a count of the number of objects contained in the mapping result. This is an aggregate count of all objects across all mapped key paths in the result.

Instance Methods

array

Returns a representation of the mapping result as an array of objects.

- (NSArray *)array

Return Value

An array containing the objects contained in the mapping result.

Discussion

The array returned is a flattened collection of all mapped object values contained in the underlying dictionary result representation. No guarantee is made as to the ordering of objects within the returned collection when more than one key path was mapped, as NSDictionary objects are unordered,

Declared In

RKMappingResult.h

count

Returns a count of the number of objects contained in the mapping result. This is an aggregate count of all objects across all mapped key paths in the result.

- (NSUInteger)count

Return Value

A count of the number of mapped objects in the mapping result.

Declared In

RKMappingResult.h

dictionary

Returns a representation of the mapping result as a dictionary.

- (NSDictionary *)dictionary

Return Value

A dictionary containing the mapping results.

Discussion

The keys of the returned dictionary will correspond to the mapped key paths in the source object representation and the values will be the mapped objects. The returned value is a copy of the dictionary that was used to initialize the mapping result.

Declared In

RKMappingResult.h

firstObject

Returns a representation of the mapping result as a single object by returning the first mapped value from the aggregate array of mapped objects.

- (id)firstObject

Return Value

The first object contained in the mapping result.

Discussion

The mapping result is coerced into a single object by retrieving all mapped objects and returning the first object. If the mapping result is empty, nil is returned.

Declared In

RKMappingResult.h

initWithDictionary:

Initializes the receiver with a dictionary of mapped key paths and object values.

- (id)initWithDictionary:(NSDictionary *)dictionary

Parameters

dictionary

A dictionary wherein the keys represent mapped key paths and the values represent the objects mapped at those key paths. Cannot be nil.

Return Value

The receiver, initialized with the given dictionary.

Declared In

RKMappingResult.h

set

Returns a representation of the mapping result as a set of objects.

- (NSSet *)set

Return Value

A set containing the objects contained in the mapping result.

Discussion

The set returned is a flattened collection of all mapped object values contained in the underlying dictionary result representation.

Declared In

RKMappingResult.h