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 Type
    Method
    Description
    <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.
  • 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

      <T> com.google.firestore.v1.Document entityToDocument(T entity, String documentResourceName)
      Converts an entity to a Firestore document.
      Type Parameters:
      T - the type of the object to convert
      Parameters:
      entity - the object to convert
      documentResourceName - the fully-qualified identifier of the document
      Returns:
      a Document that can be stored in Firestore
    • documentToEntity

      <T> T documentToEntity(com.google.firestore.v1.Document document, Class<T> clazz)
      Converts a Firestore document to an entity.
      Type Parameters:
      T - the type of the target object
      Parameters:
      document - the Document to convert
      clazz - 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)