File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
firebase-firestore/src/main/java/com/google/firebase/firestore Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 4343 * WriteBatch#set(DocumentReference, Object)}), the property annotated by {@code @DocumentId} is
4444 * ignored, which allows writing the POJO back to any document, even if it's not the origin of the
4545 * POJO.
46+ *
47+ * <h3>Kotlin Note</h3>
48+ * When applying this annotation to a property of a Kotlin class, the {@code @set} use-site target
49+ * should always be used. There is no need to use the {@code @get} use-site target as this
50+ * annotation is <em>only</em> considered when <em>reading</em> instances from Firestore, and is
51+ * ignored when <em>writing</em> instances into Firestore.
52+ * <p>
53+ * Here is an example of a class that can both be written into and read from Firestore whose
54+ * {@code foo} property will be populated with the Document ID when being read and will be ignored
55+ * when being written into Firestore:
56+ * <pre>
57+ * data class Pojo(@set:DocumentId var foo: String? = null) {
58+ * constructor() : this(null) // Used by Firestore to create new instances
59+ * }
60+ * </pre>
4661 */
4762@ Retention (RetentionPolicy .RUNTIME )
4863@ Target ({ElementType .FIELD , ElementType .METHOD })
You can’t perform that action at this time.
0 commit comments