Class QueryImpl<T>
- All Implemented Interfaces:
Query<T>
,QueryExecute<T>
,QueryResultIterable<T>
,SimpleQuery<T>
,Cloneable
,Iterable<T>
- Author:
- Jeff Schnitzer invalid input: '<'[email protected]>
-
Field Summary
Fields inherited from class com.googlecode.objectify.impl.SimpleQueryImpl
loader
-
Method Summary
Modifier and TypeMethodDescriptioncom.google.cloud.datastore.AggregationResult
aggregate
(com.google.cloud.datastore.aggregation.Aggregation... aggregations) Run the specified aggregations given the query setup as currently defined.com.google.cloud.datastore.AggregationResult
aggregate
(com.google.cloud.datastore.aggregation.AggregationBuilder<?>... aggregations) Run the specified aggregations given the query setup as currently defined.clone()
filter
(com.google.cloud.datastore.StructuredQuery.Filter filter) Create a filter based on the raw low-level Filter.Create an arbitrarily complex filter.Create a filter based on the specified condition and value, using the same syntax as the GAE/Python query class.first()
Gets the first entity in the result set.iterable()
Starts an asynchronous query which will return entities.com.google.cloud.datastore.QueryResults
<T> iterator()
list()
Execute the query and get the results as a List.Sorts based on a property.toString()
Generates a string that consistently and uniquely specifies this query.protected FilterOperator
Converts the textual operator (">", "invalid input: '<'=", etc) into a FilterOperator.Methods inherited from class com.googlecode.objectify.impl.SimpleQueryImpl
ancestor, chunk, chunkAll, distinct, endAt, filterKey, filterKey, hybrid, keys, limit, offset, orderKey, project, startAt
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface com.googlecode.objectify.cmd.Query
ancestor, chunk, chunkAll, distinct, endAt, filterKey, filterKey, hybrid, limit, offset, orderKey, project, startAt
Methods inherited from interface com.googlecode.objectify.cmd.QueryExecute
stream
-
Method Details
-
filter
Description copied from interface:Query
Create a filter based on the specified condition and value, using the same syntax as the GAE/Python query class. Examples:
filter("age >=", age)
filter("age =", age)
filter("age", age)
(if no operator, = is assumed)filter("age !=", age)
filter("age IN", Arrays.asList(25, 35, 45)
filter("age !IN", Arrays.asList(25, 35, 45)
The space between the property name and the operator is required. Filtering a condition of
"age>="
will perform an equality test on an entity property exactly named "age>=". You can't create properties like this with Objectify, but you can with the Low-Level API.Multiple calls to filter() will produce an AND (intersection) query.
==
is an alias of=
,<>
is an alias of!=
.See the Google documentation for indexes for an explanation of what you can and cannot filter for.
You can not filter on @Id or @Parent properties. Use
filterKey()
orancestor()
instead. -
filter
Description copied from interface:Query
Create a filter based on the raw low-level Filter. This is a very low-level operation; the values in the Filter are not translated in any way. For example, this only understands native datastore
Key
objects and not ObjectifyKey<?>
objects.See the Google documentation for indexes for an explanation of what you can and cannot filter for.
You can not filter on @Id or @Parent properties. Use
filterKey()
orancestor()
instead. -
filter
Description copied from interface:Query
Create an arbitrarily complex filter. This method is preferred to the low-level Filter method because it has better ergonomics and automatically handles objects like Objectify
Key<?>
andRef<?>
.Construct Filter objects using static methods on the Filter class.
Note that like the other filter methods, you can not filter on @Id or @Parent properties. You can filter by
__key__
however. -
order
Description copied from interface:Query
Sorts based on a property. Examples:
order("age")
order("-age")
(descending sort)
You can not sort on @Id or @Parent properties. Sort by __key__ or -__key__ instead.
-
translate
Converts the textual operator (">", "invalid input: '<'=", etc) into a FilterOperator. Forgiving about the syntax; != and invalid input: '<'> are NOT_EQUAL, = and == are EQUAL. -
toString
Description copied from interface:SimpleQuery
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.
- Specified by:
toString
in interfaceQueryExecute<T>
- Specified by:
toString
in interfaceSimpleQuery<T>
- Overrides:
toString
in classObject
-
first
Description copied from interface:QueryExecute
Gets the first entity in the result set. Obeys the offset value.- Specified by:
first
in interfaceQueryExecute<T>
- Returns:
- an asynchronous result containing the first result. The result will hold null if the result set is empty.
-
aggregate
public com.google.cloud.datastore.AggregationResult aggregate(com.google.cloud.datastore.aggregation.Aggregation... aggregations) Description copied from interface:SimpleQuery
Run the specified aggregations given the query setup as currently defined. limit and offset are obeyed.
- Specified by:
aggregate
in interfaceSimpleQuery<T>
- See Also:
-
aggregate
public com.google.cloud.datastore.AggregationResult aggregate(com.google.cloud.datastore.aggregation.AggregationBuilder<?>... aggregations) Description copied from interface:SimpleQuery
Run the specified aggregations given the query setup as currently defined. limit and offset are obeyed.
- Specified by:
aggregate
in interfaceSimpleQuery<T>
- See Also:
-
iterable
Description copied from interface:QueryExecute
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. - Specified by:
iterable
in interfaceQueryExecute<T>
-
iterator
-
list
Description copied from interface:QueryExecute
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.
- Specified by:
list
in interfaceQueryExecute<T>
-
clone
-