Package com.google.cloud.firestore.annotation (3.6.0)

Annotation Types

DocumentId

Annotation used to mark a POJO property to be automatically populated with the document's ID when the POJO is created from a Cloud Firestore document (for example, via DocumentSnapshot#toObject).

    Any of the following will throw a runtime exception:
  • This annotation is applied to a property of a type other than String or DocumentReference.
  • This annotation is applied to a property that is not writable (for example, a Java Bean getter without a backing field).
  • This annotation is applied to a property with a name that conflicts with a read document field. For example, if a POJO has a field firstName annotated by @DocumentId, and there is a property from the document named firstName as well, an exception is thrown when you try to read the document into the POJO via DocumentSnapshot#toObject or DocumentReference#get.

When using a POJO to write to a document (via DocumentReference#set or @WriteBatch#set), the property annotated by @DocumentId is ignored, which allows writing the POJO back to any document, even if it's not the origin of the POJO.

Exclude

Marks a field as excluded from the Database.

IgnoreExtraProperties

Properties that don't map to class fields are ignored when serializing to a class annotated with this annotation.

PropertyName

Marks a field to be renamed when serialized.

ServerTimestamp

Annotation used to mark a timestamp field as being populated via Server Timestamps. If a POJO being written contains null for a @ServerTimestamp annotated field, it will be replaced with a server-generated timestamp.

ThrowOnExtraProperties

Properties that don't map to class fields when serializing to a class annotated with this annotation cause an exception to be thrown.