Class DocumentChange (3.21.1)

public class DocumentChange

A DocumentChange represents a change to the documents matching a query. It contains the document affected and a the type of change that occurred (added, modifed, or removed).

Inheritance

Object > DocumentChange

Methods

equals(Object obj)

public boolean equals(Object obj)

Returns true if this DocumentChange is equal to the provided object.

Parameter
Name Description
obj Object

The object to compare against.

Returns
Type Description
boolean

Whether this DocumentChange is equal to the provided object.

Overrides

getDocument()

public QueryDocumentSnapshot getDocument()

Returns the newly added or modified document if this DocumentChange is for an updated document. Returns the deleted document if this document change represents a removal.

Returns
Type Description
QueryDocumentSnapshot

A snapshot of the new data (for Type.ADDED or Type.MODIFIED) or the removed data (for Type.REMOVED).

getNewIndex()

public int getNewIndex()

The index of the changed document in the result set immediately after this DocumentChange (specifically, supposing that all prior DocumentChange objects and the current DocumentChange object have been applied). Returns -1 for 'removed' events.

Returns
Type Description
int

getOldIndex()

public int getOldIndex()

The index of the changed document in the result set immediately prior to this DocumentChange (specifically, supposing that all prior DocumentChange objects have been applied). Returns -1 for 'added' events.

Returns
Type Description
int

getType()

public DocumentChange.Type getType()
Returns
Type Description
DocumentChange.Type

hashCode()

public int hashCode()
Returns
Type Description
int
Overrides