Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.

public final class QuerySnapshot

  1. Object
  2. QuerySnapshot
The state of a listened document or query, with the changes since the previous delivery.

Methods

public static QuerySnapshot diff(Map<String, DocumentSnapshot> previous, List<DocumentSnapshot> current, boolean fromPolling)Compares two states.
public boolean hasNoChanges()
public List<DocumentSnapshot> getDocuments()
public List<DocumentSnapshot> getAdded()
public List<DocumentSnapshot> getModified()
public List<DocumentSnapshot> getRemoved()
public boolean isFromPolling()

Inherited methods

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 Map<String, DocumentSnapshot>
the last delivered documents by name, may be empty
current List<DocumentSnapshot>
the new documents in result order
fromPolling boolean
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