Package io.objectbox
Class Cursor<T>
java.lang.Object
io.objectbox.Cursor<T>
- All Implemented Interfaces:
Closeable,AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BoxStoreprotected booleanprivate final Throwableprotected final longprotected final EntityInfo<T> (package private) static booleanprotected static final intprotected static final intprotected final boolean(package private) static booleanMay be set by testsprotected final Transaction -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCursor(Transaction tx, long cursor, EntityInfo<T> entityInfo, BoxStore boxStore) -
Method Summary
Modifier and TypeMethodDescriptionprotected <TARGET> voidcheckApplyToManyToDb(List<TARGET> relationField, Class<TARGET> targetClass) voidclose()protected static longcollect002033(long cursor, long keyIfComplete, int flags, int idLong1, long valueLong1, int idLong2, long valueLong2, int idFloat1, float valueFloat1, int idFloat2, float valueFloat2, int idFloat3, float valueFloat3, int idDouble1, double valueDouble1, int idDouble2, double valueDouble2, int idDouble3, double valueDouble3) protected static longcollect004000(long cursor, long keyIfComplete, int flags, int idLong1, long valueLong1, int idLong2, long valueLong2, int idLong3, long valueLong3, int idLong4, long valueLong4) protected static longcollect313311(long cursor, long keyIfComplete, int flags, int idStr1, String valueStr1, int idStr2, String valueStr2, int idStr3, String valueStr3, int idBA1, byte[] valueBA1, int idLong1, long valueLong1, int idLong2, long valueLong2, int idLong3, long valueLong3, int idInt1, int valueInt1, int idInt2, int valueInt2, int idInt3, int valueInt3, int idFloat1, float valueFloat1, int idDouble1, double valueDouble1) protected static longcollect400000(long cursor, long keyIfComplete, int flags, int idStr1, String valueStr1, int idStr2, String valueStr2, int idStr3, String valueStr3, int idStr4, String valueStr4) protected static longcollect430000(long cursor, long keyIfComplete, int flags, int idStr1, String valueStr1, int idStr2, String valueStr2, int idStr3, String valueStr3, int idStr4, String valueStr4, int idBA1, byte[] valueBA1, int idBA2, byte[] valueBA2, int idBA3, byte[] valueBA3) protected static longcollectCharArray(long cursor, long keyIfComplete, int flags, int propertyId, char[] value) protected static longcollectDoubleArray(long cursor, long keyIfComplete, int flags, int propertyId, double[] value) protected static longcollectFloatArray(long cursor, long keyIfComplete, int flags, int propertyId, float[] value) protected static longcollectIntArray(long cursor, long keyIfComplete, int flags, int propertyId, int[] value) protected static longcollectLongArray(long cursor, long keyIfComplete, int flags, int propertyId, long[] value) protected static longcollectShortArray(long cursor, long keyIfComplete, int flags, int propertyId, short[] value) protected static longcollectStringArray(long cursor, long keyIfComplete, int flags, int idStringArray, String[] stringArray) protected static longcollectStringList(long cursor, long keyIfComplete, int flags, int idStringList, List<String> stringList) longcount(long maxCountOrZero) voidbooleandeleteEntity(long key) protected voidfinalize()Explicitly callclose()instead to avoid expensive finalization.first()get(long key) getAll()getBacklinkEntities(int entityId, Property<?> relationIdProperty, long key) (package private) long[]getBacklinkIds(int entityId, Property<?> relationIdProperty, long key) protected abstract longintgetPropertyId(String propertyName) getRelationEntities(int sourceEntityId, int relationId, long key, boolean backlink) long[]getRelationIds(int sourceEntityId, int relationId, long key, boolean backlink) protected <TARGET> Cursor<TARGET> getRelationTargetCursor(Class<TARGET> targetClass) Note: this returns a secondary cursor, which does not survive standalone.getTx()(package private) longbooleanisClosed()boolean(package private) longlookupKeyUsingIndex(int propertyId, String value) Deprecated.TODO only used in tests, remove in the futurevoidmodifyRelations(int relationId, long key, long[] targetKeys, boolean remove) voidmodifyRelationsSingle(int relationId, long key, long targetKey, boolean remove) (package private) longnativeCount(long cursor, long maxCountOrZero) (package private) voidnativeDeleteAll(long cursor) (package private) static booleannativeDeleteEntity(long cursor, long key) (package private) voidnativeDestroy(long cursor) (package private) static ObjectnativeFirstEntity(long cursor) nativeGetAllEntities(long cursor) nativeGetBacklinkEntities(long cursor, int entityId, int propertyId, long key) (package private) long[]nativeGetBacklinkIds(long cursor, int entityId, int propertyId, long key) (package private) longnativeGetCursorFor(long cursor, int entityId) (package private) static ObjectnativeGetEntity(long cursor, long key) nativeGetRelationEntities(long cursor, int sourceEntityId, int relationId, long key, boolean backlink) (package private) long[]nativeGetRelationIds(long cursor, int sourceEntityId, int relationId, long key, boolean backlink) (package private) static longnativeLookupKeyUsingIndex(long cursor, int propertyId, String value) (package private) voidnativeModifyRelations(long cursor, int relationId, long key, long[] targetKeys, boolean remove) (package private) voidnativeModifyRelationsSingle(long cursor, int relationId, long key, long targetKey, boolean remove) (package private) static ObjectnativeNextEntity(long cursor) (package private) intnativePropertyId(long cursor, String propertyValue) (package private) longnativeRenew(long cursor) (package private) static booleannativeSeek(long cursor, long key) (package private) voidnativeSetBoxStoreForEntities(long cursor, Object boxStore) next()abstract longvoidrenew()To be used in combination withTransaction.renew().booleanseek(long key) toString()
-
Field Details
-
TRACK_CREATION_STACK
May be set by tests -
LOG_READ_NOT_CLOSED
-
PUT_FLAG_FIRST
protected static final int PUT_FLAG_FIRST- See Also:
-
PUT_FLAG_COMPLETE
protected static final int PUT_FLAG_COMPLETE- See Also:
-
tx
-
cursor
protected final long cursor -
entityInfo
-
boxStoreForEntities
-
readOnly
protected final boolean readOnly -
closed
protected boolean closed -
creationThrowable
-
-
Constructor Details
-
Cursor
-
-
Method Details
-
nativeDestroy
void nativeDestroy(long cursor) -
nativeDeleteEntity
static boolean nativeDeleteEntity(long cursor, long key) -
nativeDeleteAll
void nativeDeleteAll(long cursor) -
nativeSeek
static boolean nativeSeek(long cursor, long key) -
nativeGetAllEntities
-
nativeGetEntity
-
nativeNextEntity
-
nativeFirstEntity
-
nativeCount
long nativeCount(long cursor, long maxCountOrZero) -
nativeLookupKeyUsingIndex
-
nativeRenew
long nativeRenew(long cursor) -
collect313311
protected static long collect313311(long cursor, long keyIfComplete, int flags, int idStr1, @Nullable String valueStr1, int idStr2, @Nullable String valueStr2, int idStr3, @Nullable String valueStr3, int idBA1, @Nullable byte[] valueBA1, int idLong1, long valueLong1, int idLong2, long valueLong2, int idLong3, long valueLong3, int idInt1, int valueInt1, int idInt2, int valueInt2, int idInt3, int valueInt3, int idFloat1, float valueFloat1, int idDouble1, double valueDouble1) -
collect430000
protected static long collect430000(long cursor, long keyIfComplete, int flags, int idStr1, @Nullable String valueStr1, int idStr2, @Nullable String valueStr2, int idStr3, @Nullable String valueStr3, int idStr4, @Nullable String valueStr4, int idBA1, @Nullable byte[] valueBA1, int idBA2, @Nullable byte[] valueBA2, int idBA3, @Nullable byte[] valueBA3) -
collect400000
-
collect002033
protected static long collect002033(long cursor, long keyIfComplete, int flags, int idLong1, long valueLong1, int idLong2, long valueLong2, int idFloat1, float valueFloat1, int idFloat2, float valueFloat2, int idFloat3, float valueFloat3, int idDouble1, double valueDouble1, int idDouble2, double valueDouble2, int idDouble3, double valueDouble3) -
collect004000
protected static long collect004000(long cursor, long keyIfComplete, int flags, int idLong1, long valueLong1, int idLong2, long valueLong2, int idLong3, long valueLong3, int idLong4, long valueLong4) -
collectStringArray
protected static long collectStringArray(long cursor, long keyIfComplete, int flags, int idStringArray, @Nullable String[] stringArray) -
collectStringList
-
collectShortArray
protected static long collectShortArray(long cursor, long keyIfComplete, int flags, int propertyId, @Nullable short[] value) -
collectCharArray
protected static long collectCharArray(long cursor, long keyIfComplete, int flags, int propertyId, @Nullable char[] value) -
collectIntArray
protected static long collectIntArray(long cursor, long keyIfComplete, int flags, int propertyId, @Nullable int[] value) -
collectLongArray
protected static long collectLongArray(long cursor, long keyIfComplete, int flags, int propertyId, @Nullable long[] value) -
collectFloatArray
protected static long collectFloatArray(long cursor, long keyIfComplete, int flags, int propertyId, @Nullable float[] value) -
collectDoubleArray
protected static long collectDoubleArray(long cursor, long keyIfComplete, int flags, int propertyId, @Nullable double[] value) -
nativePropertyId
-
nativeGetBacklinkEntities
-
nativeGetBacklinkIds
long[] nativeGetBacklinkIds(long cursor, int entityId, int propertyId, long key) -
nativeGetRelationEntities
-
nativeGetRelationIds
long[] nativeGetRelationIds(long cursor, int sourceEntityId, int relationId, long key, boolean backlink) -
nativeModifyRelations
void nativeModifyRelations(long cursor, int relationId, long key, long[] targetKeys, boolean remove) -
nativeModifyRelationsSingle
void nativeModifyRelationsSingle(long cursor, int relationId, long key, long targetKey, boolean remove) -
nativeSetBoxStoreForEntities
-
nativeGetCursorFor
long nativeGetCursorFor(long cursor, int entityId) -
finalize
Explicitly callclose()instead to avoid expensive finalization. -
getId
-
put
-
getEntityInfo
-
get
-
next
-
first
-
getAll
-
deleteEntity
public boolean deleteEntity(long key) -
deleteAll
public void deleteAll() -
seek
public boolean seek(long key) -
count
public long count(long maxCountOrZero) -
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getPropertyId
-
lookupKeyUsingIndex
Deprecated.TODO only used in tests, remove in the future- Returns:
- key or 0 if not found
-
getTx
-
isObsolete
public boolean isObsolete() -
isClosed
public boolean isClosed() -
getRelationTargetCursor
Note: this returns a secondary cursor, which does not survive standalone. Secondary native cursors are destroyed once their hosting Cursor is destroyed. Thus, use it only locally and don't store it long term. -
renew
public void renew()To be used in combination withTransaction.renew(). -
internalHandle
-
getBacklinkEntities
-
getBacklinkIds
-
getRelationEntities
-
getRelationIds
@Internal public long[] getRelationIds(int sourceEntityId, int relationId, long key, boolean backlink) -
modifyRelations
-
modifyRelationsSingle
@Internal public void modifyRelationsSingle(int relationId, long key, long targetKey, boolean remove) -
checkApplyToManyToDb
-
toString
-