|
24 | 24 |
|
25 | 25 | import io.objectbox.annotation.apihint.Beta; |
26 | 26 | import io.objectbox.annotation.apihint.Internal; |
27 | | -import io.objectbox.annotation.apihint.Temporary; |
28 | 27 | import io.objectbox.relation.ToMany; |
29 | 28 |
|
30 | 29 | @SuppressWarnings({"unchecked", "SameParameterValue", "unused", "WeakerAccess", "UnusedReturnValue"}) |
@@ -113,8 +112,12 @@ protected static native long collect004000(long cursor, long keyIfComplete, int |
113 | 112 |
|
114 | 113 | static native List nativeGetBacklinkEntities(long cursor, int entityId, int propertyId, long key); |
115 | 114 |
|
| 115 | + static native long[] nativeGetBacklinkIds(long cursor, int entityId, int propertyId, long key); |
| 116 | + |
116 | 117 | static native List nativeGetRelationEntities(long cursor, int sourceEntityId, int relationId, long key, boolean backlink); |
117 | 118 |
|
| 119 | + static native long[] nativeGetRelationIds(long cursor, int sourceEntityId, int relationId, long key, boolean backlink); |
| 120 | + |
118 | 121 | static native void nativeModifyRelations(long cursor, int relationId, long key, long[] targetKeys, boolean remove); |
119 | 122 |
|
120 | 123 | static native void nativeModifyRelationsSingle(long cursor, int relationId, long key, long targetKey, boolean remove); |
@@ -281,11 +284,26 @@ List<T> getBacklinkEntities(int entityId, Property relationIdProperty, long key) |
281 | 284 | } |
282 | 285 | } |
283 | 286 |
|
| 287 | + @Internal |
| 288 | + long[] getBacklinkIds(int entityId, Property relationIdProperty, long key) { |
| 289 | + try { |
| 290 | + return nativeGetBacklinkIds(cursor, entityId, relationIdProperty.getId(), key); |
| 291 | + } catch (IllegalArgumentException e) { |
| 292 | + throw new IllegalArgumentException("Please check if the given property belongs to a valid @Relation: " |
| 293 | + + relationIdProperty, e); |
| 294 | + } |
| 295 | + } |
| 296 | + |
284 | 297 | @Internal |
285 | 298 | public List<T> getRelationEntities(int sourceEntityId, int relationId, long key, boolean backlink) { |
286 | 299 | return nativeGetRelationEntities(cursor, sourceEntityId, relationId, key, backlink); |
287 | 300 | } |
288 | 301 |
|
| 302 | + @Internal |
| 303 | + public long[] getRelationIds(int sourceEntityId, int relationId, long key, boolean backlink) { |
| 304 | + return nativeGetRelationIds(cursor, sourceEntityId, relationId, key, backlink); |
| 305 | + } |
| 306 | + |
289 | 307 | @Internal |
290 | 308 | public void modifyRelations(int relationId, long key, long[] targetKeys, boolean remove) { |
291 | 309 | nativeModifyRelations(cursor, relationId, key, targetKeys, remove); |
|
0 commit comments