Class FirestoreDefaultClassMapper

java.lang.Object
com.google.cloud.spring.data.firestore.mapping.FirestoreDefaultClassMapper
All Implemented Interfaces:
FirestoreClassMapper

public final class FirestoreDefaultClassMapper extends Object implements FirestoreClassMapper
Uses Firestore client library to provide object mapping functionality.
Since:
1.2.2
  • Constructor Details

  • 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 interface FirestoreClassMapper
      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

      public <T> com.google.firestore.v1.Document entityToDocument(T entity, String documentResourceName)
      Description copied from interface: FirestoreClassMapper
      Converts an entity to a Firestore document.
      Specified by:
      entityToDocument in interface FirestoreClassMapper
      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

      public <T> T documentToEntity(com.google.firestore.v1.Document document, Class<T> clazz)
      Description copied from interface: FirestoreClassMapper
      Converts a Firestore document to an entity.
      Specified by:
      documentToEntity in interface FirestoreClassMapper
      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

      public <T> T setUpdateTime(T entity, com.google.cloud.Timestamp updateTime)
      Specified by:
      setUpdateTime in interface FirestoreClassMapper