Skip to content

Commit bd2dd93

Browse files
committed
PropertyFlags: added unique on-conflict flags
1 parent e894cd2 commit bd2dd93

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

objectbox-java/src/main/java/io/objectbox/model/PropertyFlags.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,28 @@ private PropertyFlags() { }
7474
* (recommended mostly for 64 bit machines with values longer >200 bytes; small values are faster with a 32 bit hash)
7575
*/
7676
public static final int INDEX_HASH64 = 4096;
77+
/**
78+
* Unused yet: While our default are signed ints, queries (& indexes) need do know signing info
79+
*/
80+
public static final int UNSIGNED = 8192;
81+
/**
82+
* Unique on-conflict strategy: ignore the offending object (no changes to the existing conflicting object).
83+
* If there are multiple unique properties in an entity, this strategy is evaluated first:
84+
* if the property conflicts, no other properties will be checked for conflicts.
85+
*/
86+
public static final int UNIQUE_ON_CONFLICT_IGNORE = 16384;
87+
/**
88+
* Unique on-conflict strategy: the offending object replaces the existing conflicting object (deletes it).
89+
* If there are multiple properties using this strategy, a single put can potentially replace (delete) multiple
90+
* existing objects.
91+
*/
92+
public static final int UNIQUE_ON_CONFLICT_REPLACE = 32768;
93+
/**
94+
* Unique on-conflict strategy: the offending object overwrites the existing conflicting object while keeping
95+
* its ID. Thus, all relations pointing to the existing entity stay intact.
96+
* This is useful for a "secondary" ID, e.g. a string "ID".
97+
* Within an entity, this strategy may be used once only (update target would be ambiguous otherwise).
98+
*/
99+
public static final int UNIQUE_ON_CONFLICT_UPDATE = 65536;
77100
}
78101

0 commit comments

Comments
 (0)