Interface ReadWriteConversions
- All Known Implementing Classes:
TwoStepsConversions
public interface ReadWriteConversions
An interface for type conversions on read and on write.
- Since:
- 1.1
-
Method Summary
Modifier and TypeMethodDescription<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.<T> T
convertOnRead
(Object val, Class targetCollectionType, Class targetComponentType) Converts a given object to an object of a target type.com.google.cloud.datastore.Value
convertOnWrite
(Object obj, DatastorePersistentProperty persistentProperty) Converts an object to a Cloud DatastoreValue
; supports collections.com.google.cloud.datastore.Value
Converts an object to a Cloud DatastoreValue
, for non-collection objects.getDatastoreCompatibleType
(Class inputType) Get the Cloud Datastore-compatible native Java type that can be used to store the given type.void
registerEntityConverter
(DatastoreEntityConverter datastoreEntityConverter) RegistersDatastoreEntityConverter
to be used for embedded entities.
-
Method Details
-
convertOnRead
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 DatastoreValue
; supports collections.- Parameters:
obj
- the objects to convert.persistentProperty
- the source field information.- Returns:
- a Cloud Datastore value.
-
convertOnWriteSingle
Converts an object to a Cloud DatastoreValue
, for non-collection objects.- Parameters:
obj
- the object to convert.- Returns:
- a Cloud Datastore value.
-
getDatastoreCompatibleType
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
RegistersDatastoreEntityConverter
to be used for embedded entities.- Parameters:
datastoreEntityConverter
- the DatastoreEntityConverter.
-