A QuerySnapshot
contains the results of a query. It can contain zero or more
DocumentSnapshot
objects.
Subclassing Note: Cloud Firestore classes are not meant to be subclassed except for use in test mocks. Subclassing is not supported in production code and new SDK releases may break code that does so.
Public Method Summary
boolean | |
List<DocumentChange> |
getDocumentChanges()
Returns the list of documents that changed since the last snapshot.
|
List<DocumentChange> |
getDocumentChanges(MetadataChanges
metadataChanges)
Returns the list of documents that changed since the last snapshot.
|
List<DocumentSnapshot> |
getDocuments()
Returns the documents in this
QuerySnapshot as a List in order of
the query.
|
SnapshotMetadata | |
Query |
getQuery()
|
int |
hashCode()
|
boolean |
isEmpty()
Returns true if there are no documents in the
QuerySnapshot .
|
Iterator<QueryDocumentSnapshot> |
iterator()
|
int |
size()
Returns the number of documents in the
QuerySnapshot .
|
<T> List<T> |
toObjects(Class<T>
clazz,
DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior)
Returns the contents of the documents in the
QuerySnapshot ,
converted to the provided class, as a list.
|
<T> List<T> |
Inherited Method Summary
Public Methods
public boolean equals (Object obj)
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.
Documents with changes only to their metadata will not be included.
Returns
- The list of document changes since the last snapshot.
public List<DocumentChange> getDocumentChanges (MetadataChanges metadataChanges)
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.
Parameters
metadataChanges | Indicates whether metadata-only changes (i.e. only
DocumentSnapshot.getMetadata() changed) should be included. |
---|
Returns
- The list of document changes since the last snapshot.
public List<DocumentSnapshot> getDocuments ()
Returns the documents in this QuerySnapshot
as a List in order of the
query.
Returns
- The list of documents.
public SnapshotMetadata getMetadata ()
Returns
- The metadata for this query snapshot.
public Query getQuery ()
public int hashCode ()
public boolean isEmpty ()
Returns true if there are no documents in the QuerySnapshot
.
public Iterator<QueryDocumentSnapshot> iterator ()
public int size ()
Returns the number of documents in the QuerySnapshot
.
public List<T> toObjects (Class<T> clazz, DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior)
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. |
---|---|
serverTimestampBehavior | Configures the behavior for server timestamps that have not yet been set to their final value. |