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 Details

    • query

      protected final QueryT query
    • readTime

      protected final com.google.cloud.Timestamp readTime
  • Constructor Details

  • Method Details

    • getQuery

      @Nonnull public QueryT getQuery()
      Returns the query for the snapshot.
      Returns:
      The backing query that produced this snapshot.
    • getReadTime

      @Nonnull public com.google.cloud.Timestamp getReadTime()
      Returns the time at which this snapshot was read.
      Returns:
      The read time of this snapshot.
    • getDocuments

      @Nonnull public List<QueryDocumentSnapshot> 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

      Specified by:
      iterator in interface Iterable<QueryT>
    • toObjects

      @Nonnull public <T> List<T> toObjects(@Nonnull Class<T> clazz)
      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

      @Nonnull 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:
      The list of documents that changed since the last snapshot.
    • size

      public int size()
      Returns the number of DocumentSnapshots in this snapshot.
    • equals

      public boolean equals(Object o)
      Tests for equality with this object.
      Overrides:
      equals in class Object
      Parameters:
      o - is tested for equality with this object.
      Returns:
      `true` if equal, otherwise `false`
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object