The mapping operation provides support for mapping a dictionary of metadata in addition to the source object. This metadata is made available by mapping key paths nested under a specially designated parent key (@metadata
) that cannot exist in a source representation. The metadata is also nested under subkeys to effectively namespace usage between components. An example of metadata mapping would be getting an object index from the collection it came from. To do so, we can write the following code:
[mapping addAttributeMappingsFromDictionary:@{ @"@metadata.mapping.collectionIndex": @"index" }];
The @metadata
prefix indicates that the property is to be mapped from the metadata dictionary instead of from the source object representation. If any relationships were mapped, it would have access to this same metadata information as well. The possible metadata information that can be available for mapping is shown in the following table:
@metadata. suffixes |
Description |
---|---|
|