Package com.google.cloud.firestore
Class AggregateQuery
java.lang.Object
com.google.cloud.firestore.AggregateQuery
A query that calculates aggregations over an underlying query.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this object with the given object for equality.static AggregateQueryfromProto(Firestore firestore, RunAggregationQueryRequest proto) Returns an AggregateQuery instance that can be used to execute the providedRunAggregationQueryRequest.com.google.api.core.ApiFuture<AggregateQuerySnapshot>get()Executes this query.getQuery()Returns the query whose aggregations will be calculated by this object.inthashCode()Calculates and returns the hash code for this object.toProto()Returns theRunAggregationQueryRequestthat this AggregateQuery instance represents.
-
Method Details
-
getQuery
Returns the query whose aggregations will be calculated by this object. -
get
Executes this query.- Returns:
- An
ApiFuturethat will be resolved with the results of the query.
-
toProto
Returns theRunAggregationQueryRequestthat this AggregateQuery instance represents. The request contain the serialized form of all aggregations and Query constraints.- Returns:
- the serialized RunAggregationQueryRequest
-
fromProto
@Nonnull public static AggregateQuery fromProto(Firestore firestore, RunAggregationQueryRequest proto) Returns an AggregateQuery instance that can be used to execute the providedRunAggregationQueryRequest.Only RunAggregationQueryRequests that pertain to the same project as the Firestore instance can be deserialized.
- Parameters:
firestore- a Firestore instance to apply the query to.proto- the serialized RunAggregationQueryRequest.- Returns:
- a AggregateQuery instance that can be used to execute the RunAggregationQueryRequest.
-
hashCode
public int hashCode()Calculates and returns the hash code for this object. -
equals
Compares this object with the given object for equality.This object is considered "equal" to the other object if and only if all of the following conditions are satisfied:
objectis a non-null instance ofAggregateQuery.objectperforms the same aggregations as thisAggregateQuery.- The underlying
Queryofobjectcompares equal to that of this object.
-