Package com.google.cloud.firestore
Class AggregateQuerySnapshot
java.lang.Object
com.google.cloud.firestore.AggregateQuerySnapshot
The results of executing an
AggregateQuery.-
Method Summary
Modifier and TypeMethodDescriptionbooleanCompares this object with the given object for equality.get(AggregateField aggregateField) Returns the result of the given aggregation from the server without coercion of data types.get(AggregateField.AverageAggregateField averageAggregateField) Returns the result of the given average aggregation.longReturns the number of documents in the result set of the underlying query.longgetCount()Returns the number of documents in the result set of the underlying query.getDouble(AggregateField aggregateField) Returns the result of the given aggregation as a double.getLong(AggregateField aggregateField) Returns the result of the given aggregation as a long.getQuery()Returns the query that was executed to produce this result.com.google.cloud.TimestampReturns the time at which this snapshot was read.inthashCode()Calculates and returns the hash code for this object.
-
Method Details
-
getQuery
Returns the query that was executed to produce this result. -
getReadTime
Returns the time at which this snapshot was read. -
getCount
public long getCount()Returns the number of documents in the result set of the underlying query. -
get
Returns the number of documents in the result set of the underlying query. -
get
Returns the result of the given aggregation from the server without coercion of data types. Throws java.lang.RuntimeException if the `aggregateField` was not requested when calling `query.aggregate(...)`.- Parameters:
aggregateField- The aggregation for which the value is requested.- Returns:
- The result of the given aggregation.
-
get
Returns the result of the given average aggregation. Since the result of an average aggregation performed by the server is always a double, this convenience overload can be used in lieu of the above `get` method. Throws java.lang.RuntimeException if the `aggregateField` was not requested when calling `query.aggregate(...)`.- Parameters:
averageAggregateField- The average aggregation for which the value is requested.- Returns:
- The result of the given average aggregation.
-
getDouble
Returns the result of the given aggregation as a double. Coerces all numeric values and throws a RuntimeException if the result of the aggregate is non-numeric. In the case of coercion of long to double, uses java.lang.Long.doubleValue to perform the conversion, and may result in a loss of precision.- Parameters:
aggregateField- The aggregation for which the value is requested.- Returns:
- The result of the given average aggregation as a double.
-
getLong
Returns the result of the given aggregation as a long. Coerces all numeric values and throws a RuntimeException if the result of the aggregate is non-numeric. In case of coercion of double to long, uses java.lang.Double.longValue to perform the conversion.- Parameters:
aggregateField- The aggregation for which the value is requested.- Returns:
- The result of the given average aggregation as a long.
-
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 ofAggregateQuerySnapshot.- The
AggregateQueryofobjectcompares equal to that of this object. objecthas the same results as this object.
-
hashCode
public int hashCode()Calculates and returns the hash code for this object.
-