Class DatastoreMappingContext
java.lang.Object
org.springframework.data.mapping.context.AbstractMappingContext<DatastorePersistentEntity<?>,DatastorePersistentProperty>
com.google.cloud.spring.data.datastore.core.mapping.DatastoreMappingContext
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,org.springframework.context.ApplicationEventPublisherAware
,org.springframework.context.EnvironmentAware
,org.springframework.data.mapping.context.MappingContext<DatastorePersistentEntity<?>,
DatastorePersistentProperty>
public class DatastoreMappingContext
extends org.springframework.data.mapping.context.AbstractMappingContext<DatastorePersistentEntity<?>,DatastorePersistentProperty>
implements org.springframework.context.ApplicationContextAware
A mapping context for Datastore that provides ways to create persistent entities and properties.
- Since:
- 1.1
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addDiscriminationClassConnection
(Class parentClass, Class subClass) Registers in the DatastoreMappingContext that two classes are discriminated from the same Datastore Kind.protected <T> DatastorePersistentEntityImpl<T>
constructPersistentEntity
(org.springframework.data.util.TypeInformation<T> typeInformation) protected <T> DatastorePersistentEntity<?>
createPersistentEntity
(org.springframework.data.util.TypeInformation<T> typeInformation) protected DatastorePersistentProperty
createPersistentProperty
(org.springframework.data.mapping.model.Property property, DatastorePersistentEntity<?> owner, org.springframework.data.mapping.model.SimpleTypeHolder simpleTypeHolder) getDatastorePersistentEntity
(Class<?> entityClass) A non-null version of theMappingContext.getPersistentEntity(Class)
.getDiscriminationFamily
(Class clazz) Get the set of other classes that share the same underlying Datastore Kind and that are subclasses of the given class.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) Methods inherited from class org.springframework.data.mapping.context.AbstractMappingContext
addPersistentEntity, addPersistentEntity, afterPropertiesSet, doFindPersistentPropertyPaths, findPersistentPropertyPaths, getManagedTypes, getPersistentEntities, getPersistentEntity, getPersistentEntity, getPersistentEntity, getPersistentPropertyPath, getPersistentPropertyPath, getPersistentPropertyPath, hasPersistentEntityFor, initialize, setApplicationEventPublisher, setBeanFactory, setEnvironment, setInitialEntitySet, setManagedTypes, setSimpleTypeHolder, setStrict, shouldCreatePersistentEntityFor, shouldCreateProperties
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.data.mapping.context.MappingContext
getRequiredPersistentEntity, getRequiredPersistentEntity, getRequiredPersistentEntity
-
Constructor Details
-
DatastoreMappingContext
public DatastoreMappingContext()
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Overrides:
setApplicationContext
in classorg.springframework.data.mapping.context.AbstractMappingContext<DatastorePersistentEntity<?>,
DatastorePersistentProperty>
-
addDiscriminationClassConnection
Registers in the DatastoreMappingContext that two classes are discriminated from the same Datastore Kind.- Parameters:
parentClass
- the superclass.subClass
- the subclass.
-
getDiscriminationFamily
Get the set of other classes that share the same underlying Datastore Kind and that are subclasses of the given class.- Parameters:
clazz
- the class to look up.- Returns:
- a
Set
of other classes that share the same Kind that are subclasses. Will benull
if this class is not discriminated from a set of other classes.
-
constructPersistentEntity
protected <T> DatastorePersistentEntityImpl<T> constructPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation) -
createPersistentEntity
protected <T> DatastorePersistentEntity<?> createPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation) - Specified by:
createPersistentEntity
in classorg.springframework.data.mapping.context.AbstractMappingContext<DatastorePersistentEntity<?>,
DatastorePersistentProperty>
-
createPersistentProperty
protected DatastorePersistentProperty createPersistentProperty(org.springframework.data.mapping.model.Property property, DatastorePersistentEntity<?> owner, org.springframework.data.mapping.model.SimpleTypeHolder simpleTypeHolder) - Specified by:
createPersistentProperty
in classorg.springframework.data.mapping.context.AbstractMappingContext<DatastorePersistentEntity<?>,
DatastorePersistentProperty>
-
getDatastorePersistentEntity
A non-null version of theMappingContext.getPersistentEntity(Class)
.- Parameters:
entityClass
- the entity type.- Returns:
- the
DatastorePersistentEntity
for the provided type. - Throws:
DatastoreDataException
- if unable to retrieve a DatastorePersistentEntity for the provided type.
-