/** * Find all Objects matching the query between the given offset and limit. This helps with pagination. */ @Nonnull public List<T> find(final long offset, final long limit) { ensureNoFilterNoComparator(); return callInReadTx(new Callable<List<T>>() { @Override public List<T> call() { List entities = nativeFind(handle, cursorHandle(), offset, limit); resolveEagerRelations(entities); return entities; } }); }
/** * Find the first Object matching the query. */ @Nullable public T findFirst() { ensureNoFilterNoComparator(); return callInReadTx(new Callable<T>() { @Override public T call() { @SuppressWarnings("unchecked") T entity = (T) nativeFindFirst(handle, cursorHandle()); resolveEagerRelation(entity); return entity; } }); }
/** * Find the unique Object matching the query. * * @throws io.objectbox.exception.NonUniqueResultException if result was not unique */ @Nullable public T findUnique() { ensureNoFilterNoComparator(); return callInReadTx(new Callable<T>() { @Override public T call() { @SuppressWarnings("unchecked") T entity = (T) nativeFindUnique(handle, cursorHandle()); resolveEagerRelation(entity); return entity; } }); }
/** * Find all Objects matching the query without actually loading the Objects. See @{@link LazyList} for details. */ @Nonnull public LazyList<T> findLazyCached() { ensureNoFilterNoComparator(); return new LazyList<>(box, findIds(), true); }
/** * Find all Objects matching the query without actually loading the Objects. See @{@link LazyList} for details. */ public LazyList<T> findLazy() { ensureNoFilterNoComparator(); return new LazyList<>(box, findIds(), false); }