public class DefaultDatastoreEntityConverter extends Object implements DatastoreEntityConverter
Constructor and Description |
---|
DefaultDatastoreEntityConverter(DatastoreMappingContext mappingContext,
ObjectToKeyFactory objectToKeyFactory) |
DefaultDatastoreEntityConverter(DatastoreMappingContext mappingContext,
ReadWriteConversions conversions) |
Modifier and Type | Method and Description |
---|---|
ReadWriteConversions |
getConversions()
Get the
ReadWriteConversions used in this converter. |
<T> DatastorePersistentEntity<T> |
getDiscriminationPersistentEntity(Class<T> entityClass,
BaseEntity<?> entity)
Provide a
DatastorePersistentEntity with support for discriminator fields. |
<R> R |
read(Class<R> clazz,
BaseEntity entity) |
<T,R> Map<T,R> |
readAsMap(BaseEntity entity,
org.springframework.data.util.TypeInformation mapTypeInformation)
Read the entity as a
Map . |
<T,R> Map<T,R> |
readAsMap(Class<T> keyType,
org.springframework.data.util.TypeInformation<R> componentType,
BaseEntity entity)
Read the entity as a
Map when the map type is unknown. |
void |
write(Object source,
BaseEntity.Builder sink) |
public DefaultDatastoreEntityConverter(DatastoreMappingContext mappingContext, ObjectToKeyFactory objectToKeyFactory)
public DefaultDatastoreEntityConverter(DatastoreMappingContext mappingContext, ReadWriteConversions conversions)
public ReadWriteConversions getConversions()
DatastoreEntityConverter
ReadWriteConversions
used in this converter.getConversions
in interface DatastoreEntityConverter
public <T,R> Map<T,R> readAsMap(BaseEntity entity, org.springframework.data.util.TypeInformation mapTypeInformation)
DatastoreEntityConverter
Map
.readAsMap
in interface DatastoreEntityConverter
T
- the type of the key in the mapR
- the type of the value in the mapentity
- the entity from Cloud Datastore.mapTypeInformation
- the actual type of the mappublic <T,R> Map<T,R> readAsMap(Class<T> keyType, org.springframework.data.util.TypeInformation<R> componentType, BaseEntity entity)
DatastoreEntityConverter
Map
when the map type is unknown.readAsMap
in interface DatastoreEntityConverter
T
- the type of the key in the mapR
- the type of the value in the mapkeyType
- 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.public <T> DatastorePersistentEntity<T> getDiscriminationPersistentEntity(Class<T> entityClass, BaseEntity<?> entity)
DatastoreEntityConverter
DatastorePersistentEntity
with support for discriminator fields.getDiscriminationPersistentEntity
in interface DatastoreEntityConverter
T
- the type of the entityentityClass
- the entity classentity
- the Datastore entityDatastorePersistentEntity
for the entity type with support for discriminator
fields.public <R> R read(Class<R> clazz, BaseEntity entity)
read
in interface org.springframework.data.convert.EntityReader<Object,BaseEntity>
public void write(Object source, BaseEntity.Builder sink)
write
in interface org.springframework.data.convert.EntityWriter<Object,BaseEntity.Builder>
Copyright © 2022. All rights reserved.