Package com.google.cloud.firestore
Class QuerySnapshot
java.lang.Object
com.google.cloud.firestore.QuerySnapshot
- All Implemented Interfaces:
Iterable<QueryDocumentSnapshot>
A QuerySnapshot contains the results of a query. It can contain zero or more DocumentSnapshot
objects.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedQuerySnapshot(Query query, com.google.cloud.Timestamp readTime) -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanReturns true if the document data in this QuerySnapshot equals the provided snapshot.abstract List<DocumentChange>Returns the list of documents that changed since the last snapshot.abstract List<QueryDocumentSnapshot>Returns the documents in this QuerySnapshot as a List in order of the query.getQuery()Returns the query for the snapshot.com.google.cloud.TimestampReturns the time at which this snapshot was read.abstract inthashCode()booleanisEmpty()Returns true if there are no documents in the QuerySnapshot.iterator()abstract intsize()Returns the number of documents in the QuerySnapshot.<T> List<T>Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.static QuerySnapshotwithChanges(Query query, com.google.cloud.Timestamp readTime, com.google.cloud.firestore.DocumentSet documentSet, List<DocumentChange> documentChanges) Creates a new QuerySnapshot representing a snapshot of a Query with changed documents.static QuerySnapshotwithDocuments(Query query, com.google.cloud.Timestamp readTime, List<QueryDocumentSnapshot> documents) Creates a new QuerySnapshot representing the results of a Query with added documents.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
QuerySnapshot
-
-
Method Details
-
withDocuments
public static QuerySnapshot withDocuments(Query query, com.google.cloud.Timestamp readTime, List<QueryDocumentSnapshot> documents) Creates a new QuerySnapshot representing the results of a Query with added documents. -
withChanges
public static QuerySnapshot withChanges(Query query, com.google.cloud.Timestamp readTime, com.google.cloud.firestore.DocumentSet documentSet, List<DocumentChange> documentChanges) Creates a new QuerySnapshot representing a snapshot of a Query with changed documents. -
getQuery
Returns the query for the snapshot.- Returns:
- The backing query that produced this snapshot.
-
getReadTime
Returns the time at which this snapshot was read.- Returns:
- The read time of this snapshot.
-
getDocuments
Returns the documents in this QuerySnapshot as a List in order of the query.- Returns:
- The list of documents.
-
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:
- The list of documents that changed since the last snapshot.
-
isEmpty
public boolean isEmpty()Returns true if there are no documents in the QuerySnapshot. -
size
public abstract int size()Returns the number of documents in the QuerySnapshot. -
iterator
- Specified by:
iteratorin interfaceIterable<QueryDocumentSnapshot>
-
toObjects
Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.- Parameters:
clazz- The POJO type used to convert the documents in the list.
-
equals
Returns true if the document data in this QuerySnapshot equals the provided snapshot. -
hashCode
public abstract int hashCode()
-