public class DocumentSnapshot extends Object
Known Direct Subclasses |
A DocumentSnapshot
contains data read from a document in your Cloud Firestore
database. The data can be extracted with the getData()
or
get(String)
methods.
If the DocumentSnapshot
points to a non-existing document, getData()
and its corresponding methods will return null
. You can always explicitly check
for a document's existence by calling exists()
.
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.
Nested Class Summary
enum | DocumentSnapshot.ServerTimestampBehavior | Controls the return value for server timestamps that have not yet been set to their final value. |
Public Method Summary
boolean | |
boolean | |
boolean | |
boolean |
exists()
|
<T> T |
get(FieldPath
fieldPath, Class<T>
valueType,
DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior)
Returns the value at the field, converted to a POJO, or
null if
the field or document doesn't exist.
|
<T> T |
get(String field,
Class<T>
valueType,
DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior)
Returns the value at the field, converted to a POJO, or
null if
the field or document doesn't exist.
|
Object |
get(String field,
DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior)
Returns the value at the field or
null if the field doesn't exist.
|
Object | |
Object |
get(FieldPath
fieldPath,
DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior)
Returns the value at the field or
null if the field or document
doesn't exist.
|
<T> T | |
<T> T | |
Object | |
Blob | |
Boolean | |
Map<String, Object> |
getData(DocumentSnapshot.ServerTimestampBehavior
serverTimestampBehavior)
Returns the fields of the document as a Map or
null if the
document doesn't exist.
|
Map<String, Object> |
getData()
Returns the fields of the document as a Map or
null if the
document doesn't exist.
|
Date | |
Date |
getDate(String field,
DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior)
Returns the value of the field as a Date.
|
DocumentReference | |
Double | |
GeoPoint | |
String |
getId()
|
Long | |
SnapshotMetadata | |
DocumentReference |
getReference()
Gets the reference to the document.
|
String | |
Timestamp |
getTimestamp(String field,
DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior)
Returns the value of the field as a
com.google.firebase.Timestamp .
|
Timestamp | |
int |
hashCode()
|
<T> T | |
<T> T |