Interface QueryExecute<T>
- All Superinterfaces:
Iterable<T>
,QueryResultIterable<T>
- All Known Subinterfaces:
Loader
,LoadType<T>
,Query<T>
,QueryKeys<T>
,SimpleQuery<T>
- All Known Implementing Classes:
QueryImpl
,SimpleQueryImpl
- Author:
- Jeff Schnitzer <[email protected]>
-
Method Summary
Modifier and TypeMethodDescriptionfirst()
Gets the first entity in the result set.iterable()
Starts an asynchronous query which will return entities.list()
Execute the query and get the results as a List.stream()
Execute the query and get the results as a Stream.toString()
Generates a string that consistently and uniquely specifies this query.Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface com.googlecode.objectify.cmd.QueryResultIterable
iterator
-
Method Details
-
iterable
QueryResultIterable<T> iterable()Starts an asynchronous query which will return entities.
Note that since the Query
itself is QueryResultIterable , you can iterate on the query object itself. However, if you want to start an async query and iterate on it later, you can use this method. -
list
Execute the query and get the results as a List. The list will be equivalent to a simple ArrayList; you can iterate through it multiple times without incurring additional datastore cost.
Note that you must be careful about limit()ing the size of the list returned; you can easily exceed the practical memory limits of Appengine by querying for a very large dataset.
-
stream
Execute the query and get the results as a Stream.
-
first
LoadResult<T> first()Gets the first entity in the result set. Obeys the offset value.- Returns:
- an asynchronous result containing the first result. The result will hold null if the result set is empty.
-
toString
String toString()Generates a string that consistently and uniquely specifies this query. There is no way to convert this string back into a query and there is no guarantee that the string will be consistent across versions of Objectify.
In particular, this value is useful as a key for a simple memcache query cache.
-