public class QueryDocumentSnapshot extends DocumentSnapshot
getData()
or DocumentSnapshot.get(String)
methods.
QueryDocumentSnapshot offers the same API surface as DocumentSnapshot
. Since query
results contain only existing documents, the DocumentSnapshot.exists()
method will always return true and
getData()
will never be null.
Subclassing Note: 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.
Modifier | Constructor and Description |
---|---|
protected |
QueryDocumentSnapshot(com.google.cloud.firestore.FirestoreImpl firestore,
DocumentReference docRef,
Map<String,com.google.firestore.v1.Value> fields,
Timestamp readTime,
Timestamp updateTime,
Timestamp createTime) |
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
getData()
Returns the fields of the document as a Map.
|
<T> T |
toObject(Class<T> valueType)
Returns the contents of the document converted to a POJO.
|
contains, contains, equals, exists, get, get, getBlob, getBoolean, getCreateTime, getDate, getDouble, getGeoPoint, getId, getLong, getReadTime, getReference, getString, getTimestamp, getUpdateTime, hashCode
@Nonnull public Map<String,Object> getData()
getData
in class DocumentSnapshot
@Nonnull public <T> T toObject(@Nonnull Class<T> valueType)
toObject
in class DocumentSnapshot
valueType
- The Java class to createCopyright © 2019 Google LLC. All rights reserved.