# Class: DataMapping

## DataMapping

#### new DataMapping()

Maps raw data to data objects of a specific type. Currently services define their mapping by overriding their mapRawDataToObject() and mapObjectToRawData() methods or by using a DataMapping subclass that overrides its mapRawDataToObject() and mapRawDataToObject() methods. In the future it will be possible to define mappings declaratively through mapping descriptors read from blueprint files.

Source:
  - data/service/data-mapping.js, line 18

### Extends

- external:Montage

### Members

#### mapFromRawData

Source:
  - data/service/data-mapping.js, line 88
To Do:
  - Document deprecation in favor of mapRawDataToObject()

#### mapObjectToRawData

Source:
  - data/service/data-mapping.js, line 64
To Do:
  - Document.

#### mapToRawData

Source:
  - data/service/data-mapping.js, line 98
To Do:
  - Document deprecation in favor of mapObjectToRawData()

### Methods

#### mapRawDataToObject(object, data, context)

Convert raw data to data objects of an appropriate type. Subclasses should override this method to map properties of the raw data to data objects, as in the following: mapRawDataToObject: { value: function (object, data) { object.firstName = data.GIVEN_NAME; object.lastName = data.FAMILY_NAME; } } The default implementation of this method copies the properties defined by the raw data object to the data object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`object` | Object | An object whose properties must be set or modified to represent the raw data.
`data` | Object | An object whose properties' values hold the raw data.
`context` | ? | A value that was passed in to the addRawData() call that invoked this method.

Source:
  - data/service/data-mapping.js, line 49