# Module: montage/serialization/serialization

### Requires

- module:montage/core

### Classes

Serialization
SerializationExtractor
SerializationInspector
SerializationMerger

### Type Definitions

#### delegateWillMergeObjectWithLabel(label, newLabel) → {string|undefined}

This delegate method is called when merging an object from serialization2 into serialization1. It allows the delegate to change how the object is going to be merged by saying that the object already exists in serialization1 under a different or the same label. When the delegate method doesn't return a string then the default behavior is to add a new object to serialization1. If the object's label collides with another label in serialization1 then a new label is generated and used. By returning a label that exists in serialization1 from the delegate method all references to the object being merged will change to point to the object from serialization1 instead and the object will not be merged. By returning a label that does not exist in both serializations the object will be merged into serialization2 with this new label instead.

##### Parameters:

Name | Type | Description
--- | --- | ---
`label` | string | The object label.
`newLabel` | string | The new label generated by the collision resolver in case of collision.

Source:
  - core/serialization/serialization.js, line 233

##### Returns:

the new label for this object.

Type
  string | undefined