Sync Android SDK  0.8.7
com.twilio.sync.Mutator Class Referenceabstract

Mutator is a functional object that you provide to modify entity data in a controlled manner. More...

Public Member Functions

 Mutator ()
 Sole constructor. More...
 
JSONObject onApplied (JSONObject currentData)
 Override this method to provide your own implementation of data mutator. More...
 

Detailed Description

Mutator is a functional object that you provide to modify entity data in a controlled manner.

Override

to perform your modifications. This method will be provided with the previous data contents and should return new desired contents or null to abort mutate operation.

You must dispose() a mutator to avoid memory leaks. Internally, the native part will keep a strong reference to the Java class, keeping it from being GC'd.

Constructor & Destructor Documentation

com.twilio.sync.Mutator.Mutator ( )

Sole constructor.

(For invocation by subclass constructors, typically implicit.)

Member Function Documentation

JSONObject com.twilio.sync.Mutator.onApplied ( JSONObject  currentData)

Override this method to provide your own implementation of data mutator.

Default implementation returns null which causes the mutation to abort.

Parameters
currentDataCurrent contents of the entity to modify.
Returns
New contents of the entity that will replace the old contents or null to abort the edit entirely.