Interface DatastoreEntityConverter
- All Superinterfaces:
org.springframework.data.convert.EntityReader<Object,
,com.google.cloud.datastore.BaseEntity> org.springframework.data.convert.EntityWriter<Object,
com.google.cloud.datastore.BaseEntity.Builder>
- All Known Implementing Classes:
DefaultDatastoreEntityConverter
public interface DatastoreEntityConverter
extends org.springframework.data.convert.EntityReader<Object,com.google.cloud.datastore.BaseEntity>, org.springframework.data.convert.EntityWriter<Object,com.google.cloud.datastore.BaseEntity.Builder>
An interface for converting objects to Datastore Entities and vice versa.
- Since:
- 1.1
-
Method Summary
Modifier and TypeMethodDescriptionGet theReadWriteConversions
used in this converter.<T> DatastorePersistentEntity<T>
getDiscriminationPersistentEntity
(Class<T> entityClass, com.google.cloud.datastore.BaseEntity<?> entity) Provide aDatastorePersistentEntity
with support for discriminator fields.<T,
R> Map<T, R> readAsMap
(com.google.cloud.datastore.BaseEntity entity, org.springframework.data.util.TypeInformation mapTypeInformation) Read the entity as aMap
.<T,
R> Map<T, R> readAsMap
(Class<T> keyType, org.springframework.data.util.TypeInformation<R> componentType, com.google.cloud.datastore.BaseEntity entity) Read the entity as aMap
when the map type is unknown.Methods inherited from interface org.springframework.data.convert.EntityReader
read
Methods inherited from interface org.springframework.data.convert.EntityWriter
write
-
Method Details
-
getConversions
ReadWriteConversions getConversions()Get theReadWriteConversions
used in this converter.- Returns:
- the conversions used.
-
getDiscriminationPersistentEntity
<T> DatastorePersistentEntity<T> getDiscriminationPersistentEntity(Class<T> entityClass, com.google.cloud.datastore.BaseEntity<?> entity) Provide aDatastorePersistentEntity
with support for discriminator fields.- Type Parameters:
T
- the type of the entity- Parameters:
entityClass
- the entity classentity
- the Datastore entity- Returns:
DatastorePersistentEntity
for the entity type with support for discriminator fields.
-
readAsMap
<T,R> Map<T,R> readAsMap(com.google.cloud.datastore.BaseEntity entity, org.springframework.data.util.TypeInformation mapTypeInformation) Read the entity as aMap
.- Type Parameters:
T
- the type of the key in the mapR
- the type of the value in the map- Parameters:
entity
- the entity from Cloud Datastore.mapTypeInformation
- the actual type of the map- Returns:
- a Map where the key values are the field names and the values the field values.
-
readAsMap
<T,R> Map<T,R> readAsMap(Class<T> keyType, org.springframework.data.util.TypeInformation<R> componentType, com.google.cloud.datastore.BaseEntity entity) Read the entity as aMap
when the map type is unknown.- Type Parameters:
T
- the type of the key in the mapR
- the type of the value in the map- Parameters:
keyType
- the key type of the map to be read.componentType
- the value type of the map, into which each field value will be converted.entity
- the entity from Cloud Datastore.- Returns:
- a Map where the key values are the field names and the values the field values.
-