io.realm
Esta clase describe cómo se guardan los datos en Realm al guardar objetos completos.
Enum Constant Summary
Enum Constant and Description |
|---|
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. |
Resumen del método
Modificador y Tipo | Método y descripción |
|---|---|
values () |
Inherited Methods
Métodos heredados de la clase java.lang.Object:
getClass,hashCode,equals,clone,toString,notify,notifyAll,wait,wait,wait,finalizeMétodos heredados de la clase java.lang.Enum :
name,ordinal,toString,equals,hashCode,clone,compareTo,getDeclaringClass,valueOf,finalize
Detalle de constante de enumeración
CHECK_SAME_VALUES_BEFORE_SET
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:
El servidor comienza con (Campo A = 1, Campo B = 1)
Device 1 writes (Field A = 2, Field B = 2).
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.
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.
Detalle del método
valueOf
values
public static ImportFlag values () |
|---|