Interface ReadWriteConversions

All Known Implementing Classes:
TwoStepsConversions

public interface ReadWriteConversions
An interface for type conversions on read and on write.
Since:
1.1
  • Method Details

    • convertOnRead

      <T> T convertOnRead(Object val, Class targetCollectionType, Class targetComponentType)
      Converts a given object to an object of a target type.
      Type Parameters:
      T - the type of the object that is produced by reading
      Parameters:
      val - the simple type or Iterable value to convert. Arrays are not supported.
      targetCollectionType - the type of the collection to be converted into. null if the property is a singular object.
      targetComponentType - the type of the property to convert. For collection-like properties this refers to the individual items' type.
      Returns:
      an object of a target type.
    • convertOnRead

      <T> T convertOnRead(Object val, EmbeddedType embeddedType, org.springframework.data.util.TypeInformation targetTypeInformation)
      Converts a given object to an object of a target type that is possibly an embedded entity.
      Type Parameters:
      T - the type of the object that is produced by reading
      Parameters:
      val - the simple type or Iterable value to convert. Arrays are not supported.
      embeddedType - contains the type of embedded entity conversion should produce.
      targetTypeInformation - type metadata information for the desired type.
      Returns:
      an object of a target type.
    • convertOnWrite

      com.google.cloud.datastore.Value convertOnWrite(Object obj, DatastorePersistentProperty persistentProperty)
      Converts an object to a Cloud Datastore Value; supports collections.
      Parameters:
      obj - the objects to convert.
      persistentProperty - the source field information.
      Returns:
      a Cloud Datastore value.
    • convertOnWriteSingle

      com.google.cloud.datastore.Value convertOnWriteSingle(Object obj)
      Converts an object to a Cloud Datastore Value, for non-collection objects.
      Parameters:
      obj - the object to convert.
      Returns:
      a Cloud Datastore value.
    • getDatastoreCompatibleType

      Optional<Class<?>> getDatastoreCompatibleType(Class inputType)
      Get the Cloud Datastore-compatible native Java type that can be used to store the given type.
      Parameters:
      inputType - the given type to test.
      Returns:
      the Cloud Datastore-compatible native Java type, if it exists.
    • registerEntityConverter

      void registerEntityConverter(DatastoreEntityConverter datastoreEntityConverter)
      Registers DatastoreEntityConverter to be used for embedded entities.
      Parameters:
      datastoreEntityConverter - the DatastoreEntityConverter.