Package io.objectbox
Class Cursor<T>
- java.lang.Object
-
- io.objectbox.Cursor<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected BoxStoreboxStoreForEntitiesprotected booleanclosedprivate java.lang.ThrowablecreationThrowableprotected longcursorprotected EntityInfo<T>entityInfo(package private) static booleanLOG_READ_NOT_CLOSEDprotected static intPUT_FLAG_COMPLETEprotected static intPUT_FLAG_FIRSTprotected booleanreadOnly(package private) static booleanTRACK_CREATION_STACKMay be set by testsprotected Transactiontx
-
Constructor Summary
Constructors Modifier Constructor Description protectedCursor(Transaction tx, long cursor, EntityInfo<T> entityInfo, BoxStore boxStore)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected <TARGET> voidcheckApplyToManyToDb(java.util.List<TARGET> relationField, java.lang.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, java.lang.String valueStr1, int idStr2, java.lang.String valueStr2, int idStr3, java.lang.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, java.lang.String valueStr1, int idStr2, java.lang.String valueStr2, int idStr3, java.lang.String valueStr3, int idStr4, java.lang.String valueStr4)protected static longcollect430000(long cursor, long keyIfComplete, int flags, int idStr1, java.lang.String valueStr1, int idStr2, java.lang.String valueStr2, int idStr3, java.lang.String valueStr3, int idStr4, java.lang.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, java.lang.String[] stringArray)protected static longcollectStringList(long cursor, long keyIfComplete, int flags, int idStringList, java.util.List<java.lang.String> stringList)longcount(long maxCountOrZero)voiddeleteAll()booleandeleteEntity(long key)protected voidfinalize()Explicitly callclose()instead to avoid expensive finalization.Tfirst()Tget(long key)java.util.List<T>getAll()(package private) java.util.List<T>getBacklinkEntities(int entityId, Property<?> relationIdProperty, long key)(package private) long[]getBacklinkIds(int entityId, Property<?> relationIdProperty, long key)EntityInfo<T>getEntityInfo()protected abstract longgetId(T entity)intgetPropertyId(java.lang.String propertyName)java.util.List<T>getRelationEntities(int sourceEntityId, int relationId, long key, boolean backlink)long[]getRelationIds(int sourceEntityId, int relationId, long key, boolean backlink)protected <TARGET> Cursor<TARGET>getRelationTargetCursor(java.lang.Class<TARGET> targetClass)Note: this returns a secondary cursor, which does not survive standalone.TransactiongetTx()(package private) longinternalHandle()booleanisClosed()booleanisObsolete()(package private) longlookupKeyUsingIndex(int propertyId, java.lang.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 java.lang.ObjectnativeFirstEntity(long cursor)(package private) java.util.List<T>nativeGetAllEntities(long cursor)(package private) java.util.List<T>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 java.lang.ObjectnativeGetEntity(long cursor, long key)(package private) java.util.List<T>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, java.lang.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 java.lang.ObjectnativeNextEntity(long cursor)(package private) intnativePropertyId(long cursor, java.lang.String propertyValue)(package private) longnativeRenew(long cursor)(package private) static booleannativeSeek(long cursor, long key)(package private) voidnativeSetBoxStoreForEntities(long cursor, java.lang.Object boxStore)Tnext()abstract longput(T entity)voidrenew()To be used in combination withTransaction.renew().booleanseek(long key)java.lang.StringtoString()
-
-
-
Field Detail
-
TRACK_CREATION_STACK
@Internal static boolean TRACK_CREATION_STACK
May be set by tests
-
LOG_READ_NOT_CLOSED
@Internal static boolean LOG_READ_NOT_CLOSED
-
PUT_FLAG_FIRST
protected static final int PUT_FLAG_FIRST
- See Also:
- Constant Field Values
-
PUT_FLAG_COMPLETE
protected static final int PUT_FLAG_COMPLETE
- See Also:
- Constant Field Values
-
tx
protected final Transaction tx
-
cursor
protected final long cursor
-
entityInfo
protected final EntityInfo<T> entityInfo
-
boxStoreForEntities
protected final BoxStore boxStoreForEntities
-
readOnly
protected final boolean readOnly
-
closed
protected boolean closed
-
creationThrowable
private final java.lang.Throwable creationThrowable
-
-
Constructor Detail
-
Cursor
protected Cursor(Transaction tx, long cursor, EntityInfo<T> entityInfo, BoxStore boxStore)
-
-
Method Detail
-
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
java.util.List<T> nativeGetAllEntities(long cursor)
-
nativeGetEntity
static java.lang.Object nativeGetEntity(long cursor, long key)
-
nativeNextEntity
static java.lang.Object nativeNextEntity(long cursor)
-
nativeFirstEntity
static java.lang.Object nativeFirstEntity(long cursor)
-
nativeCount
long nativeCount(long cursor, long maxCountOrZero)
-
nativeLookupKeyUsingIndex
static long nativeLookupKeyUsingIndex(long cursor, int propertyId, java.lang.String value)
-
nativeRenew
long nativeRenew(long cursor)
-
collect313311
protected static long collect313311(long cursor, long keyIfComplete, int flags, int idStr1, @Nullable java.lang.String valueStr1, int idStr2, @Nullable java.lang.String valueStr2, int idStr3, @Nullable java.lang.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 java.lang.String valueStr1, int idStr2, @Nullable java.lang.String valueStr2, int idStr3, @Nullable java.lang.String valueStr3, int idStr4, @Nullable java.lang.String valueStr4, int idBA1, @Nullable byte[] valueBA1, int idBA2, @Nullable byte[] valueBA2, int idBA3, @Nullable byte[] valueBA3)
-
collect400000
protected static long collect400000(long cursor, long keyIfComplete, int flags, int idStr1, @Nullable java.lang.String valueStr1, int idStr2, @Nullable java.lang.String valueStr2, int idStr3, @Nullable java.lang.String valueStr3, int idStr4, @Nullable java.lang.String valueStr4)
-
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 java.lang.String[] stringArray)
-
collectStringList
protected static long collectStringList(long cursor, long keyIfComplete, int flags, int idStringList, @Nullable java.util.List<java.lang.String> stringList)
-
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
int nativePropertyId(long cursor, java.lang.String propertyValue)
-
nativeGetBacklinkEntities
java.util.List<T> nativeGetBacklinkEntities(long cursor, int entityId, int propertyId, long key)
-
nativeGetBacklinkIds
long[] nativeGetBacklinkIds(long cursor, int entityId, int propertyId, long key)
-
nativeGetRelationEntities
java.util.List<T> nativeGetRelationEntities(long cursor, int sourceEntityId, int relationId, long key, boolean backlink)
-
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
void nativeSetBoxStoreForEntities(long cursor, java.lang.Object boxStore)
-
nativeGetCursorFor
long nativeGetCursorFor(long cursor, int entityId)
-
finalize
protected void finalize() throws java.lang.ThrowableExplicitly callclose()instead to avoid expensive finalization.- Overrides:
finalizein classjava.lang.Object- Throws:
java.lang.Throwable
-
getId
protected abstract long getId(T entity)
-
put
public abstract long put(T entity)
-
getEntityInfo
public EntityInfo<T> getEntityInfo()
-
get
public T get(long key)
-
next
public T next()
-
first
public T first()
-
getAll
public java.util.List<T> 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 interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
getPropertyId
public int getPropertyId(java.lang.String propertyName)
-
lookupKeyUsingIndex
long lookupKeyUsingIndex(int propertyId, java.lang.String value)Deprecated.TODO only used in tests, remove in the future- Returns:
- key or 0 if not found
-
getTx
public Transaction getTx()
-
isObsolete
public boolean isObsolete()
-
isClosed
public boolean isClosed()
-
getRelationTargetCursor
protected <TARGET> Cursor<TARGET> getRelationTargetCursor(java.lang.Class<TARGET> targetClass)
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
@Internal long internalHandle()
-
getBacklinkEntities
@Internal java.util.List<T> getBacklinkEntities(int entityId, Property<?> relationIdProperty, long key)
-
getBacklinkIds
@Internal long[] getBacklinkIds(int entityId, Property<?> relationIdProperty, long key)
-
getRelationEntities
@Internal public java.util.List<T> getRelationEntities(int sourceEntityId, int relationId, long key, boolean backlink)
-
getRelationIds
@Internal public long[] getRelationIds(int sourceEntityId, int relationId, long key, boolean backlink)
-
modifyRelations
@Internal public void modifyRelations(int relationId, long key, long[] targetKeys, boolean remove)
-
modifyRelationsSingle
@Internal public void modifyRelationsSingle(int relationId, long key, long targetKey, boolean remove)
-
checkApplyToManyToDb
protected <TARGET> void checkApplyToManyToDb(java.util.List<TARGET> relationField, java.lang.Class<TARGET> targetClass)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-