Class AggregateQuerySnapshot (3.15.3)

public class AggregateQuerySnapshot

The results of executing an AggregateQuery.

Inheritance

Object > AggregateQuerySnapshot

Methods

equals(Object object)

public boolean equals(Object object)

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:

  1. object is a non-null instance of AggregateQuerySnapshot.
  2. The AggregateQuery of object compares equal to that of this object.
  3. object has the same results as this object.
Parameter
NameDescription
objectObject

The object to compare to this object for equality.

Returns
TypeDescription
boolean

true if this object is "equal" to the given object, as defined above, or false otherwise.

Overrides

get(AggregateField aggregateField)

public Object get(AggregateField aggregateField)

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(...).

Parameter
NameDescription
aggregateFieldAggregateField

The aggregation for which the value is requested.

Returns
TypeDescription
Object

The result of the given aggregation.

get(AggregateField.AverageAggregateField averageAggregateField)

public Double get(AggregateField.AverageAggregateField averageAggregateField)

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(...).

Parameter
NameDescription
averageAggregateFieldAggregateField.AverageAggregateField

The average aggregation for which the value is requested.

Returns
TypeDescription
Double

The result of the given average aggregation.

get(AggregateField.CountAggregateField unused)

public long get(AggregateField.CountAggregateField unused)

Returns the number of documents in the result set of the underlying query.

Parameter
NameDescription
unusedAggregateField.CountAggregateField
Returns
TypeDescription
long

getCount()

public long getCount()

Returns the number of documents in the result set of the underlying query.

Returns
TypeDescription
long

getDouble(AggregateField aggregateField)

public Double getDouble(AggregateField aggregateField)

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.

Parameter
NameDescription
aggregateFieldAggregateField

The aggregation for which the value is requested.

Returns
TypeDescription
Double

The result of the given average aggregation as a double.

getLong(AggregateField aggregateField)

public Long getLong(AggregateField aggregateField)

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.

Parameter
NameDescription
aggregateFieldAggregateField

The aggregation for which the value is requested.

Returns
TypeDescription
Long

The result of the given average aggregation as a long.

getQuery()

public AggregateQuery getQuery()

Returns the query that was executed to produce this result.

Returns
TypeDescription
AggregateQuery

getReadTime()

public Timestamp getReadTime()

Returns the time at which this snapshot was read.

Returns
TypeDescription
com.google.cloud.Timestamp

hashCode()

public int hashCode()

Calculates and returns the hash code for this object.

Returns
TypeDescription
int

the hash code for this object.

Overrides