MergableObjectOperations <T>
Index
Methods
clone
Deep clone the object.
Returns T
isEqual
Returns
trueif objects are considered to be equal. OtherwisefalseParameters
o: T
Object to compare with.
Returns boolean
onAdded
Called when the object is first added to to
<T>by calling<T>.addOrUpdate and if the object does not already exist in MergableSet. In that case the local object will get MergableObjectState.Added. Also called if a remote object, for which there is no corresponding local or remote object in MergableSet, is detected during calls to<T>.saveAndMerge or<T>.loadAndMerge. In that case the local object get the state MergableObjectState.Unchanged.Parameters
o: MergableObjectEventArgs<T>
Gives both local and (optional) remote representation of object. Also gives (rare but possible) conflict reason if it exists. A conflict may occur if a local object with same MergableObject.id has been added by calling
<T>.addOrUpdate when no remote counterpart existed. Once<T>.saveAndMerge or<T>.loadAndMerge is called a remote counter part (same id) is detected and their content differs. This should only happen if non unique id's are assigned to objects.
Returns void
onDelete
Called when
- Layer<T>.delete is called.
- Layer<T>.save or Layer<T>.load is called and item exists in client (and is unchanged) but no longer in backend. That means that somebody has removed it and store that in the backend. Hence it must be removed
Parameters
o: MergableObjectEventArgs<T>
Gives both local and (optional) remote representation of object. Also gives (rare but possible) conflict reason if it exists. A conflict may occur if a local object with same MergableObject.id has been added by calling
<T>.addOrUpdate when no remote counterpart existed. Once<T>.saveAndMerge or<T>.loadAndMerge is called a remote counter part (same id) is detected and their content differs. This should only happen if non unique id's are assigned to objects.
Returns void
trueif there is no conflict or conflict could be resolved.- Layer
onUpdate
This event is called when local object already exists in
<T>and does not have state MergableObjectState.Added and one of the following holds true- If state is MergableObjectState.Unchanged and a call to <T>.loadAndMerge or<T>.saveAndMerge results in a detection that the remote object has changed and it differs from the local object
- Calling <T>.addOrUpdate
Parameters
o: MergableObjectEventArgs<T>
Gives both local and (optional) remote representation of object. Also gives (rare but possible) conflict reason if it exists. A conflict may occur if a local object with same MergableObject.id has been added by calling
<T>.addOrUpdate when no remote counterpart existed. Once<T>.saveAndMerge or<T>.loadAndMerge is called a remote counter part (same id) is detected and their content differs. This should only happen if non unique id's are assigned to objects.
Returns void
- If state is MergableObjectState.Unchanged and a call to
Operations that a MergableObject must implement