Package com.google.cloud.firestore
Class GenericQuerySnapshot<QueryT>
java.lang.Object
com.google.cloud.firestore.GenericQuerySnapshot<QueryT>
- All Implemented Interfaces:
Iterable<QueryDocumentSnapshot>
- Direct Known Subclasses:
QuerySnapshot,VectorQuerySnapshot
public abstract class GenericQuerySnapshot<QueryT>
extends Object
implements Iterable<QueryDocumentSnapshot>
Abstract. A GenericQuerySnapshot represents the results of a query that returns documents. It can
contain zero or more DocumentSnapshot objects.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGenericQuerySnapshot(QueryT query, com.google.cloud.Timestamp readTime, List<QueryDocumentSnapshot> documents, List<DocumentChange> documentChanges) -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests for equality with this object.Returns the list of documents that changed since the last snapshot.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.inthashCode()booleanisEmpty()Returns true if there are no documents in the QuerySnapshot.iterator()intsize()Returns the number of DocumentSnapshots in this snapshot.<T> List<T>Returns the contents of the documents in the QuerySnapshot, converted to the provided class, as a list.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
query
-
readTime
protected final com.google.cloud.Timestamp readTime
-
-
Constructor Details
-
GenericQuerySnapshot
protected GenericQuerySnapshot(QueryT query, com.google.cloud.Timestamp readTime, @Nonnull List<QueryDocumentSnapshot> documents, List<DocumentChange> documentChanges)
-
-
Method Details
-
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.
-
isEmpty
public boolean isEmpty()Returns true if there are no documents in the QuerySnapshot. -
iterator
-
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.
-
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.
-
size
public int size()Returns the number of DocumentSnapshots in this snapshot. -
equals
Tests for equality with this object. -
hashCode
public int hashCode() -
toString
-