Join us at MongoDB.local London on 7 May to unlock new possibilities for your data. Use WEB50 to save 50%.
Register now >
Docs Menu
Docs Home
/ /
io.realm

Enum ImportFlag

java.lang.Object
io.realm.ImportFlag

Esta clase describe cómo se guardan los datos en Realm al guardar objetos completos.

Tip

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.

Modificador y Tipo
Método y descripción
  • Métodos heredados de la clase java.lang.Object: getClass , hashCode , equals , clone , toString , notify , notifyAll , wait , wait , wait , finalize

  • Métodos heredados de la clase 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. El servidor comienza con (Campo A = 1, Campo B = 1)

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

  3. El dispositivo 2 guarda (Campo A = 3, Campo B = 1) pero ignora (Campo B = 1), porque ese es el valor en el archivo Realm en este punto.

  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).

Normalmente, este es el comportamiento deseado, ya que el objeto final es el resultado combinado de los últimos cambios de ambos dispositivos. Sin embargo, si todos los campos de un objeto se consideran una unidad atómica, entonces esta bandera no debe establecerse, ya que garantizará que todos los campos estén configurados y, por lo tanto, tengan la misma "edad" cuando se envíen los datos al servidor.

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

Volver

Fila pendiente congelada

En esta página