Class GenericQuerySnapshot<QueryT> (3.28.0)

public abstract class GenericQuerySnapshot<QueryT> implements Iterable<QueryDocumentSnapshot>

Abstract. A GenericQuerySnapshot represents the results of a query that returns documents. It can contain zero or more DocumentSnapshot objects.

Inheritance

Object > GenericQuerySnapshot<QueryT>

Type Parameter

Name Description
QueryT

Constructors

GenericQuerySnapshot(QueryT query, Timestamp readTime, List<QueryDocumentSnapshot> documents, List<DocumentChange> documentChanges)

protected GenericQuerySnapshot(QueryT query, Timestamp readTime, List<QueryDocumentSnapshot> documents, List<DocumentChange> documentChanges)
Parameters
Name Description
query QueryT
readTime com.google.cloud.Timestamp
documents List<QueryDocumentSnapshot>
documentChanges List<DocumentChange>

Fields

query

protected final QueryT query
Field Value
Type Description
QueryT

readTime

protected final Timestamp readTime
Field Value
Type Description
com.google.cloud.Timestamp

Methods

<T>toObjects(Class<T> clazz)

public List<T> <T>toObjects(Class<T> clazz)

Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.

Parameter
Name Description
clazz Class<T>

The POJO type used to convert the documents in the list.

Returns
Type Description
List<T>

equals(Object o)

public boolean equals(Object o)

Tests for equality with this object.

Parameter
Name Description
o Object

is tested for equality with this object.

Returns
Type Description
boolean

true if equal, otherwise false

Overrides

getDocumentChanges()

public List<DocumentChange> getDocumentChanges()

Returns the list of documents that changed since the last snapshot. If it's the first snapshot all documents will be in the list as added changes.

Returns
Type Description
List<DocumentChange>

The list of documents that changed since the last snapshot.

getDocuments()

public List<QueryDocumentSnapshot> getDocuments()

Returns the documents in this QuerySnapshot as a List in order of the query.

Returns
Type Description
List<QueryDocumentSnapshot>

The list of documents.

getQuery()

public QueryT getQuery()

Returns the query for the snapshot.

Returns
Type Description
QueryT

The backing query that produced this snapshot.

getReadTime()

public Timestamp getReadTime()

Returns the time at which this snapshot was read.

Returns
Type Description
com.google.cloud.Timestamp

The read time of this snapshot.

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides

isEmpty()

public boolean isEmpty()

Returns true if there are no documents in the QuerySnapshot.

Returns
Type Description
boolean

iterator()

public Iterator<QueryDocumentSnapshot> iterator()
Returns
Type Description
Iterator<QueryDocumentSnapshot>

size()

public int size()

Returns the number of DocumentSnapshots in this snapshot.

Returns
Type Description
int

toString()

public String toString()
Returns
Type Description
String
Overrides