Docs Menu

Docs HomeDevelop ApplicationsAtlas Device SDKs

Enum ImportFlag

On this page

  • io.realm
  • Enum Constant Summary
  • Method Summary
  • Inherited Methods
  • Enum Constant Detail
  • CHECK_SAME_VALUES_BEFORE_SET
  • Method Detail
  • valueOf
  • values

This class describe how data is saved to Realm when saving whole objects.

Tip

See also:

Enum Constant and Description

CHECK_SAME_VALUES_BEFORE_SET

With this flag enabled, fields will not be written to the Realm file if they contain the same value as the value already present in the Realm.

Modifier and Type
Method and Description
public static ImportFlag
public static ImportFlag
  • Methods inherited from class java.lang.Object : getClass , hashCode , equals , clone , toString , notify , notifyAll , wait , wait , wait , finalize

  • Methods inherited from class java.lang.Enum : name , ordinal , toString , equals , hashCode , clone , compareTo , getDeclaringClass , valueOf , finalize

public static final ImportFlag

With this flag enabled, fields will not be written to the Realm file if they contain the same value as the value already present in the Realm.For local Realms this only has an impact on change listeners which will not report changes to those fields that were not written.

For synchronized Realms this also impacts the server, which will see improved performance as there are fewer changes to upload and merge into the server Realm.

It also impacts how the server merges changes from different devices. Realm uses a last-write-wins approach when merging individual fields in an object, so if a field is not written it will be considered "older" than other fields modified.

E.g:

  1. Server starts out with (Field A = 1, Field B = 1)

  2. Device 1 writes (Field A = 2, Field B = 2).

  3. Device 2 writes (Field A = 3, Field B = 1) but ignores (Field B = 1), because that is the value in the Realm file at this point.

  4. Device 1 uploads its changes to the server making the server (Field A = 2, Field B = 2). Then Device 2 uploads its changes. Due to last-write-wins, the server version now becomes (Field A = 3, Field B = 2).

This is normally the desired behavior as the final object is the merged result of the latest changes from both devices, however if all the fields in an object are considered an atomic unit, then this flag should not be set as it will ensure that all fields are set and thus have the same "age" when data are sent to the server.

public static ImportFlag valueOf (
String name
)
public static ImportFlag values ()

← Enum FrozenPendingRow