@Test public void testToObjects() { when(TestUtil.firestore().getFirestoreSettings()) .thenReturn(new FirebaseFirestoreSettings.Builder().build()); ObjectValue objectData = ObjectValue.fromMap(map("timestamp", ServerTimestamps.valueOf(Timestamp.now(), null))); QuerySnapshot foo = TestUtil.querySnapshot("foo", map(), map("a", objectData), true, false); List<POJO> docs = foo.toObjects(POJO.class); assertEquals(1, docs.size()); assertNull(docs.get(0).timestamp); docs = foo.toObjects(POJO.class, ServerTimestampBehavior.ESTIMATE); assertEquals(1, docs.size()); assertNotNull(docs.get(0).timestamp); }
@NonNull public <T> List<T> toObjects(@NonNull Class<T> clazz) { return toObjects(clazz, DocumentSnapshot.ServerTimestampBehavior.DEFAULT); }
QuerySnapshot implements Iterable<QueryDocumentSnapshot> { @NonNull public <T> List<T> toObjects(@NonNull Class<T> clazz) { return toObjects(clazz, DocumentSnapshot.ServerTimestampBehavior.DEFAULT); } }
QuerySnapshot implements Iterable<QueryDocumentSnapshot> { @NonNull public <T> List<T> toObjects(@NonNull Class<T> clazz) { return toObjects(clazz, DocumentSnapshot.ServerTimestampBehavior.DEFAULT); } QuerySnapshot(Query originalQuery, ViewSnapshot snapshot, FirebaseFirestore firestore); }
QuerySnapshot implements Iterable<QueryDocumentSnapshot> { @NonNull public <T> List<T> toObjects(@NonNull Class<T> clazz) { return toObjects(clazz, DocumentSnapshot.ServerTimestampBehavior.DEFAULT); } QuerySnapshot(Query originalQuery, ViewSnapshot snapshot, FirebaseFirestore firestore); @NonNull Query getQuery(); @NonNull SnapshotMetadata getMetadata(); @NonNull List<DocumentChange> getDocumentChanges(); @NonNull List<DocumentChange> getDocumentChanges(@NonNull MetadataChanges metadataChanges); @NonNull List<DocumentSnapshot> getDocuments(); boolean isEmpty(); int size(); @Override @NonNull Iterator<QueryDocumentSnapshot> iterator(); @NonNull List<T> toObjects(@NonNull Class<T> clazz); @NonNull List<T> toObjects(
      @NonNull Class<T> clazz,
      @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior); @Override boolean equals(@Nullable Object obj); @Override int hashCode(); }
QuerySnapshot implements Iterable<QueryDocumentSnapshot> { @NonNull public <T> List<T> toObjects(@NonNull Class<T> clazz) { return toObjects(clazz, DocumentSnapshot.ServerTimestampBehavior.DEFAULT); } QuerySnapshot(Query originalQuery, ViewSnapshot snapshot, FirebaseFirestore firestore); @NonNull Query getQuery(); @NonNull SnapshotMetadata getMetadata(); @NonNull List<DocumentChange> getDocumentChanges(); @NonNull List<DocumentChange> getDocumentChanges(@NonNull MetadataChanges metadataChanges); @NonNull List<DocumentSnapshot> getDocuments(); boolean isEmpty(); int size(); @Override @NonNull Iterator<QueryDocumentSnapshot> iterator(); @NonNull List<T> toObjects(@NonNull Class<T> clazz); @NonNull List<T> toObjects(
      @NonNull Class<T> clazz,
      @NonNull DocumentSnapshot.ServerTimestampBehavior serverTimestampBehavior); @Override boolean equals(@Nullable Object obj); @Override int hashCode();  }