public abstract class QuerySnapshot implements Iterable<QueryDocumentSnapshot>
A QuerySnapshot contains the results of a query. It can contain zero or more DocumentSnapshot objects.
Implements
Iterable<QueryDocumentSnapshot>Static Methods
withChanges(Query query, Timestamp readTime, DocumentSet documentSet, List<DocumentChange> documentChanges)
public static QuerySnapshot withChanges(Query query, Timestamp readTime, DocumentSet documentSet, List<DocumentChange> documentChanges)
Creates a new QuerySnapshot representing a snapshot of a Query with changed documents.
Parameters | |
---|---|
Name | Description |
query |
Query |
readTime |
com.google.cloud.Timestamp |
documentSet |
com.google.cloud.firestore.DocumentSet |
documentChanges |
List<DocumentChange> |
Returns | |
---|---|
Type | Description |
QuerySnapshot |
withDocuments(Query query, Timestamp readTime, List<QueryDocumentSnapshot> documents)
public static QuerySnapshot withDocuments(Query query, Timestamp readTime, List<QueryDocumentSnapshot> documents)
Creates a new QuerySnapshot representing the results of a Query with added documents.
Parameters | |
---|---|
Name | Description |
query |
Query |
readTime |
com.google.cloud.Timestamp |
documents |
List<QueryDocumentSnapshot> |
Returns | |
---|---|
Type | Description |
QuerySnapshot |
Constructors
QuerySnapshot(Query query, Timestamp readTime)
protected QuerySnapshot(Query query, Timestamp readTime)
Parameters | |
---|---|
Name | Description |
query |
Query |
readTime |
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 obj)
public abstract boolean equals(Object obj)
Returns true if the document data in this QuerySnapshot equals the provided snapshot.
Parameter | |
---|---|
Name | Description |
obj |
Object The object to compare against. |
Returns | |
---|---|
Type | Description |
boolean |
Whether this QuerySnapshot is equal to the provided object. |
getDocumentChanges()
public abstract 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 abstract 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 Query getQuery()
Returns the query for the snapshot.
Returns | |
---|---|
Type | Description |
Query |
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 abstract int hashCode()
Returns | |
---|---|
Type | Description |
int |
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 abstract int size()
Returns the number of documents in the QuerySnapshot.
Returns | |
---|---|
Type | Description |
int |