GeezerVison is showing github.com — Shared IDs: add property on Sync annotation. · TinyAndNeo/objectbox-java@144f004
File tree
Expand file treeCollapse file tree
Open diff view settings
objectbox-java-api/src/main/java/io/objectbox/annotation
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: objectbox-java-api/src/main/java/io/objectbox/annotation/Sync.java +14Lines changed: 14 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
14 | 14 | @Retention(RetentionPolicy.CLASS) |
15 | 15 | @Target(ElementType.TYPE) |
16 | 16 | public @interface Sync { |
| 17 | + |
| 18 | + /** |
| 19 | + * Set to {@code true} to enable shared global IDs for a {@link Sync}-enabled {@link Entity} class. |
| 20 | + * <p> |
| 21 | + * By default each Sync client has its own local {@link Id ID} space for Objects. |
| 22 | + * IDs are mapped to global IDs when syncing behind the scenes. Turn this on |
| 23 | + * to treat Object IDs as global and turn of ID mapping. The ID of an Object will |
| 24 | + * then be the same on all clients. |
| 25 | + * <p> |
| 26 | + * When using this, it is recommended to use {@link Id#assignable() assignable IDs} |
| 27 | + * to turn off automatically assigned IDs. Without special care, two Sync clients are |
| 28 | + * likely to overwrite each others Objects if IDs are assigned automatically. |
| 29 | + */ |
| 30 | + boolean sharedGlobalIds() default false; |
17 | 31 | } |