Class QuerySnapshot

java.lang.Object
com.codename1.cloud.firebase.QuerySnapshot

public final class QuerySnapshot extends Object
The state of a listened document or query, with the changes since the previous delivery.
  • Method Details

    • diff

      public static QuerySnapshot diff(Map<String, DocumentSnapshot> previous, List<DocumentSnapshot> current, boolean fromPolling)

      Compares two states. Documents are matched by name and a document counts as modified when its update time differs.

      Parameters
      • previous: the last delivered documents by name, may be empty

      • current: the new documents in result order

      • fromPolling: true when the state came from polling

      Returns

      the snapshot with its changes

    • hasNoChanges

      public boolean hasNoChanges()
      Returns

      true when nothing was added, modified or removed

    • getDocuments

      public List<DocumentSnapshot> getDocuments()
      Returns

      every document in the current state

    • getAdded

      public List<DocumentSnapshot> getAdded()
      Returns

      documents new since the previous delivery

    • getModified

      public List<DocumentSnapshot> getModified()
      Returns

      documents whose update time changed

    • getRemoved

      public List<DocumentSnapshot> getRemoved()
      Returns

      documents that left the result

    • isFromPolling

      public boolean isFromPolling()
      Returns

      true when this state came from the polling fallback, not the live channel