T
- The entity class the query will return results for.public class Query<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected AbstractDao<T,?> |
dao |
protected de.greenrobot.dao.InternalQueryDaoAccess<T> |
daoAccess |
protected int |
limitPosition |
protected int |
offsetPosition |
protected java.lang.Thread |
ownerThread |
protected java.lang.String[] |
parameters |
protected java.lang.String |
sql |
Modifier and Type | Method and Description |
---|---|
protected void |
checkThread() |
Query<T> |
forCurrentThread() |
static <T2> Query<T2> |
internalCreate(AbstractDao<T2,?> dao,
java.lang.String sql,
java.lang.Object[] initialValues)
For internal use by greenDAO only.
|
java.util.List<T> |
list()
Executes the query and returns the result as a list containing all entities loaded into memory.
|
CloseableListIterator<T> |
listIterator()
Executes the query and returns the result as a list iterator; make sure to close it to close the underlying
cursor.
|
LazyList<T> |
listLazy()
Executes the query and returns the result as a list that lazy loads the entities on first access.
|
LazyList<T> |
listLazyUncached()
Executes the query and returns the result as a list that lazy loads the entities on every access (uncached).
|
void |
setLimit(int limit)
Sets the limit of the maximum number of results returned by this Query.
|
void |
setOffset(int offset)
Sets the offset for results returned by this Query.
|
void |
setParameter(int index,
java.lang.Boolean parameter) |
void |
setParameter(int index,
java.util.Date parameter) |
void |
setParameter(int index,
java.lang.Object parameter)
Sets the parameter (0 based) using the position in which it was added during building the query.
|
protected static java.lang.String[] |
toStringArray(java.lang.Object[] values) |
T |
unique()
Executes the query and returns the unique result or null.
|
T |
uniqueOrThrow()
Executes the query and returns the unique result (never null).
|
protected final int limitPosition
protected final int offsetPosition
protected final AbstractDao<T,?> dao
protected final de.greenrobot.dao.InternalQueryDaoAccess<T> daoAccess
protected final java.lang.String sql
protected final java.lang.String[] parameters
protected final java.lang.Thread ownerThread
public static <T2> Query<T2> internalCreate(AbstractDao<T2,?> dao, java.lang.String sql, java.lang.Object[] initialValues)
public java.util.List<T> list()
public LazyList<T> listLazy()
public LazyList<T> listLazyUncached()
public CloseableListIterator<T> listIterator()
public T unique()
DaoException
- if the result is not uniquepublic T uniqueOrThrow()
DaoException
- if the result is not unique or no entity was foundpublic void setParameter(int index, java.lang.Object parameter)
public void setParameter(int index, java.util.Date parameter)
public void setParameter(int index, java.lang.Boolean parameter)
public void setLimit(int limit)
QueryBuilder.limit(int)
must
have been called on the QueryBuilder that created this Query object.public void setOffset(int offset)
QueryBuilder.offset(int)
must
have been called on
the QueryBuilder that created this Query object.protected static java.lang.String[] toStringArray(java.lang.Object[] values)
protected void checkThread()
Available under the Apache License, Version 2.0 - Copyright © 2011-2015 greenrobot.de. All Rights Reserved.