Class FirestoreDefaultClassMapper
java.lang.Object
com.google.cloud.spring.data.firestore.mapping.FirestoreDefaultClassMapper
- All Implemented Interfaces:
FirestoreClassMapper
Uses Firestore client library to provide object mapping functionality.
- Since:
- 1.2.2
-
Constructor Summary
Constructors -
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.
-
Constructor Details
-
FirestoreDefaultClassMapper
-
-
Method Details
-
toFirestoreValue
public <T> com.google.firestore.v1.Value toFirestoreValue(T sourceValue) Description copied from interface:FirestoreClassMapperConverts an entity to a Firestore type.- Specified by:
toFirestoreValuein interfaceFirestoreClassMapper- 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
Description copied from interface:FirestoreClassMapperConverts an entity to a Firestore document.- Specified by:
entityToDocumentin interfaceFirestoreClassMapper- 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
Description copied from interface:FirestoreClassMapperConverts a Firestore document to an entity.- Specified by:
documentToEntityin interfaceFirestoreClassMapper- 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
public <T> T setUpdateTime(T entity, com.google.cloud.Timestamp updateTime) - Specified by:
setUpdateTimein interfaceFirestoreClassMapper
-