本文整理了Java中io.objectbox.query.Query.findIds
方法的一些代码示例,展示了Query.findIds
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.findIds
方法的具体详情如下:
包路径:io.objectbox.query.Query
类名称:Query
方法名:findIds
[英]Very efficient way to get just the IDs without creating any objects. IDs can later be used to lookup objects (lookups by ID are also very efficient in ObjectBox).
Note: a filter set with QueryBuilder#filter will be silently ignored!
[中]这是一种非常有效的方法,可以在不创建任何对象的情况下仅获取ID。以后可以使用ID查找对象(在ObjectBox中,按ID查找也非常有效)。
注意:带有QueryBuilder#过滤器的过滤器集将被静默忽略!
代码示例来源:origin: objectbox/objectbox-java
/**
* Very efficient way to get just the IDs without creating any objects. IDs can later be used to lookup objects
* (lookups by ID are also very efficient in ObjectBox).
* <p>
* Note: a filter set with {@link QueryBuilder#filter} will be silently ignored!
*/
@Nonnull
public long[] findIds() {
return findIds(0,0);
}
代码示例来源:origin: objectbox/objectbox-java
/**
* 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);
}
代码示例来源:origin: objectbox/objectbox-java
/**
* 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);
}
代码示例来源:origin: objectbox/objectbox-java
@Override
public void run() {
LazyList<T> lazyList = new LazyList<>(box, findIds(), false);
int size = lazyList.size();
for (int i = 0; i < size; i++) {
T entity = lazyList.get(i);
if (entity == null) {
throw new IllegalStateException("Internal error: data object was null");
}
if (filter != null) {
if (!filter.keep(entity)) {
continue;
}
}
if (eagerRelations != null) {
resolveEagerRelationForNonNullEagerRelations(entity, i);
}
try {
consumer.accept(entity);
} catch (BreakForEach breakForEach) {
break;
}
}
}
});
代码示例来源:origin: objectbox/objectbox-java
@Test
public void testFindIdsWithOrder() {
putTestEntitiesScalars();
Query<TestEntity> query = box.query().orderDesc(TestEntity_.simpleInt).build();
long[] ids = query.findIds();
assertEquals(10, ids.length);
assertEquals(10, ids[0]);
assertEquals(1, ids[9]);
ids = query.findIds(3, 2);
assertEquals(2, ids.length);
assertEquals(7, ids[0]);
assertEquals(6, ids[1]);
}
代码示例来源:origin: objectbox/objectbox-java
@Test
public void testFindIds() {
putTestEntitiesScalars();
assertEquals(10, box.query().build().findIds().length);
Query<TestEntity> query = box.query().greater(simpleInt, 2006).build();
long[] keys = query.findIds();
assertEquals(3, keys.length);
assertEquals(8, keys[0]);
assertEquals(9, keys[1]);
assertEquals(10, keys[2]);
}
内容来源于网络,如有侵权,请联系作者删除!