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
-
Method Summary
Modifier and TypeMethodDescription<T> T
documentToEntity
(com.google.firestore.v1.Document document, Class<T> clazz) Converts a Firestore document to an entity.<T> com.google.firestore.v1.Document
entityToDocument
(T entity, String documentResourceName) Converts an entity to a Firestore document.<T> T
setUpdateTime
(T entity, com.google.cloud.Timestamp updateTime) <T> com.google.firestore.v1.Value
toFirestoreValue
(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:FirestoreClassMapper
Converts an entity to a Firestore type.- Specified by:
toFirestoreValue
in 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:FirestoreClassMapper
Converts an entity to a Firestore document.- Specified by:
entityToDocument
in 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
Document
that can be stored in Firestore
-
documentToEntity
Description copied from interface:FirestoreClassMapper
Converts a Firestore document to an entity.- Specified by:
documentToEntity
in interfaceFirestoreClassMapper
- Type Parameters:
T
- the type of the target object- Parameters:
document
- theDocument
to 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:
setUpdateTime
in interfaceFirestoreClassMapper
-