Interface FirestoreClassMapper
- All Known Implementing Classes:
FirestoreDefaultClassMapper
public interface FirestoreClassMapper
An interface used for object mapping for Cloud Firestore.
- Since:
- 1.2.2
-
Method Summary
Modifier and TypeMethodDescription<T> TdocumentToEntity(com.google.firestore.v1.Document document, Class<T> clazz) Converts a Firestore document to an entity.<T> com.google.firestore.v1.DocumententityToDocument(T entity, String documentResourceName) Converts an entity to a Firestore document.<T> TsetUpdateTime(T entity, com.google.cloud.Timestamp updateTime) <T> com.google.firestore.v1.ValuetoFirestoreValue(T sourceValue) Converts an entity to a Firestore type.
-
Method Details
-
toFirestoreValue
<T> com.google.firestore.v1.Value toFirestoreValue(T sourceValue) Converts an entity to a Firestore type.- Type Parameters:
T- the type of the object to convert- Parameters:
sourceValue- the object to convert- Returns:
- value that can be used to bind to a Firestore query
-
entityToDocument
Converts an entity to a Firestore document.- Type Parameters:
T- the type of the object to convert- Parameters:
entity- the object to convertdocumentResourceName- the fully-qualified identifier of the document- Returns:
- a
Documentthat can be stored in Firestore
-
documentToEntity
Converts a Firestore document to an entity.- Type Parameters:
T- the type of the target object- Parameters:
document- theDocumentto convertclazz- the type of the target entity- Returns:
- the entity that the Firestore document was converted to
-
setUpdateTime
<T> T setUpdateTime(T entity, com.google.cloud.Timestamp updateTime)
-