Package io.realm
Enum ImportFlag
- java.lang.Object
-
- java.lang.Enum<ImportFlag>
-
- io.realm.ImportFlag
-
- All Implemented Interfaces:
Serializable
,Comparable<ImportFlag>
public enum ImportFlag extends Enum<ImportFlag>
This class describe how data is saved to Realm when saving whole objects.
-
-
Enum Constant Summary
Enum Constants Enum Constant 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.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ImportFlag
valueOf(String name)
Returns the enum constant of this type with the specified name.static ImportFlag[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
CHECK_SAME_VALUES_BEFORE_SET
public static final ImportFlag 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.For local Realms this only has an impact on change listeners which will not report changes to those fields that was not written.
For synchronized Realms this also impacts the server, which will see improved performance as there is less changes to upload and merge into the server Realm.
It also impact 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:
- Server starts out with (Field A = 1, Field B = 1)
- Device 1 writes (Field A = 2, Field B = 2).
- 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.
- 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).
- See Also:
- Docs on conflict resolution
-
-
Method Detail
-
values
public static ImportFlag[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ImportFlag c : ImportFlag.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ImportFlag valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
-