Class DatastorePersistentEntityImpl<T>
java.lang.Object
org.springframework.data.mapping.model.BasicPersistentEntity<T,DatastorePersistentProperty>
com.google.cloud.spring.data.datastore.core.mapping.DatastorePersistentEntityImpl<T>
- Type Parameters:
T
- the type of the persistent entity
- All Implemented Interfaces:
DatastorePersistentEntity<T>
,Iterable<DatastorePersistentProperty>
,org.springframework.beans.factory.Aware
,org.springframework.context.ApplicationContextAware
,org.springframework.context.EnvironmentAware
,org.springframework.data.mapping.model.MutablePersistentEntity<T,
,DatastorePersistentProperty> org.springframework.data.mapping.PersistentEntity<T,
DatastorePersistentProperty>
public class DatastorePersistentEntityImpl<T>
extends org.springframework.data.mapping.model.BasicPersistentEntity<T,DatastorePersistentProperty>
implements DatastorePersistentEntity<T>
Metadata class for entities stored in Datastore.
- Since:
- 1.1
-
Constructor Summary
ConstructorsConstructorDescriptionDatastorePersistentEntityImpl
(org.springframework.data.util.TypeInformation<T> information, DatastoreMappingContext datastoreMappingContext) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
doWithColumnBackedProperties
(org.springframework.data.mapping.PropertyHandler<DatastorePersistentProperty> handler) Applies the givenPropertyHandler
to allDatastorePersistentProperty
contained in thisDatastorePersistentEntity
that are stored as columns in the table for this entity.void
doWithDescendantProperties
(org.springframework.data.mapping.PropertyHandler<DatastorePersistentProperty> handler) Applies the givenPropertyHandler
to allDatastorePersistentProperty
contained in thisDatastorePersistentEntity
that are properties backed by descendants.Get the discrimination values corresponding to this persistent entity ad its supertypes.Get the name of the field for subtype discrimination if there is one.Get the discrimination value corresponding to this persistent entity type.Gets the ID property, and will throwDatastoreDataException
if the entity does not have an ID property.protected boolean
kindName()
Gets the name of the Datastore Kind.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
verify()
Methods inherited from class org.springframework.data.mapping.model.BasicPersistentEntity
addAssociation, addPersistentProperty, doWithAssociations, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getEvaluationContext, getEvaluationContext, getFallbackIsNewStrategy, getIdentifierAccessor, getIdProperty, getInstanceCreatorMetadata, getName, getPersistenceConstructor, getPersistentProperties, getPersistentProperty, getPropertyAccessor, getPropertyPathAccessor, getType, getTypeAlias, getTypeInformation, getValueEvaluationContext, getValueEvaluationContext, getVersionProperty, hasIdProperty, hasVersionProperty, isAnnotationPresent, isCreatorArgument, isIdProperty, isImmutable, isNew, isVersionProperty, iterator, requiresPropertyPopulation, returnPropertyIfBetterIdPropertyCandidateOrNull, setEnvironment, setEvaluationContextProvider, setPersistentPropertyAccessorFactory
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.context.EnvironmentAware
setEnvironment
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface org.springframework.data.mapping.model.MutablePersistentEntity
addAssociation, addPersistentProperty, setEvaluationContextProvider, setPersistentPropertyAccessorFactory
Methods inherited from interface org.springframework.data.mapping.PersistentEntity
doWithAll, doWithAssociations, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getIdentifierAccessor, getIdProperty, getInstanceCreatorMetadata, getName, getPersistenceConstructor, getPersistentProperties, getPersistentProperty, getPersistentProperty, getPropertyAccessor, getPropertyPathAccessor, getRequiredAnnotation, getRequiredIdProperty, getRequiredPersistentProperty, getRequiredVersionProperty, getType, getTypeAlias, getTypeInformation, getVersionProperty, hasIdProperty, hasVersionProperty, isAnnotationPresent, isConstructorArgument, isCreatorArgument, isIdProperty, isImmutable, isNew, isVersionProperty, requiresPropertyPopulation
-
Constructor Details
-
DatastorePersistentEntityImpl
public DatastorePersistentEntityImpl(org.springframework.data.util.TypeInformation<T> information, DatastoreMappingContext datastoreMappingContext) Constructor.- Parameters:
information
- type information about the underlying entity type.datastoreMappingContext
- a mapping context used to get metadata for related persistent entities.
-
-
Method Details
-
hasTableName
protected boolean hasTableName() -
kindName
Description copied from interface:DatastorePersistentEntity
Gets the name of the Datastore Kind.- Specified by:
kindName
in interfaceDatastorePersistentEntity<T>
- Returns:
- the name of the Datastore Kind that stores these entities.
-
getIdPropertyOrFail
Description copied from interface:DatastorePersistentEntity
Gets the ID property, and will throwDatastoreDataException
if the entity does not have an ID property.- Specified by:
getIdPropertyOrFail
in interfaceDatastorePersistentEntity<T>
- Returns:
- the ID property.
-
verify
public void verify()- Specified by:
verify
in interfaceorg.springframework.data.mapping.model.MutablePersistentEntity<T,
DatastorePersistentProperty> - Overrides:
verify
in classorg.springframework.data.mapping.model.BasicPersistentEntity<T,
DatastorePersistentProperty>
-
getDiscriminationFieldName
Description copied from interface:DatastorePersistentEntity
Get the name of the field for subtype discrimination if there is one.- Specified by:
getDiscriminationFieldName
in interfaceDatastorePersistentEntity<T>
- Returns:
- the name of the discrimination field.
null
if this persistent entity doesn't have one.
-
getCompatibleDiscriminationValues
Description copied from interface:DatastorePersistentEntity
Get the discrimination values corresponding to this persistent entity ad its supertypes.- Specified by:
getCompatibleDiscriminationValues
in interfaceDatastorePersistentEntity<T>
- Returns:
- the list of values where the first item is this entity's discrimination value
-
getDiscriminatorValue
Description copied from interface:DatastorePersistentEntity
Get the discrimination value corresponding to this persistent entity type.- Specified by:
getDiscriminatorValue
in interfaceDatastorePersistentEntity<T>
- Returns:
- the value or
null
if there is no value for this type.
-
doWithColumnBackedProperties
public void doWithColumnBackedProperties(org.springframework.data.mapping.PropertyHandler<DatastorePersistentProperty> handler) Description copied from interface:DatastorePersistentEntity
Applies the givenPropertyHandler
to allDatastorePersistentProperty
contained in thisDatastorePersistentEntity
that are stored as columns in the table for this entity. This means properties backed by descendants or references to entities of other Kinds are not provided to thehandler
.- Specified by:
doWithColumnBackedProperties
in interfaceDatastorePersistentEntity<T>
- Parameters:
handler
- must not be null.
-
doWithDescendantProperties
public void doWithDescendantProperties(org.springframework.data.mapping.PropertyHandler<DatastorePersistentProperty> handler) Description copied from interface:DatastorePersistentEntity
Applies the givenPropertyHandler
to allDatastorePersistentProperty
contained in thisDatastorePersistentEntity
that are properties backed by descendants.- Specified by:
doWithDescendantProperties
in interfaceDatastorePersistentEntity<T>
- Parameters:
handler
- must not be null.
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-