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 TypeMethodDescriptionvoiddoWithColumnBackedProperties(org.springframework.data.mapping.PropertyHandler<DatastorePersistentProperty> handler) Applies the givenPropertyHandlerto allDatastorePersistentPropertycontained in thisDatastorePersistentEntitythat are stored as columns in the table for this entity.voiddoWithDescendantProperties(org.springframework.data.mapping.PropertyHandler<DatastorePersistentProperty> handler) Applies the givenPropertyHandlerto allDatastorePersistentPropertycontained in thisDatastorePersistentEntitythat 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 throwDatastoreDataExceptionif the entity does not have an ID property.protected booleankindName()Gets the name of the Datastore Kind.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidverify()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, setPersistentPropertyAccessorFactoryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.EnvironmentAware
setEnvironmentMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface org.springframework.data.mapping.model.MutablePersistentEntity
addAssociation, addPersistentProperty, setEvaluationContextProvider, setPersistentPropertyAccessorFactoryMethods 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:DatastorePersistentEntityGets the name of the Datastore Kind.- Specified by:
kindNamein interfaceDatastorePersistentEntity<T>- Returns:
- the name of the Datastore Kind that stores these entities.
-
getIdPropertyOrFail
Description copied from interface:DatastorePersistentEntityGets the ID property, and will throwDatastoreDataExceptionif the entity does not have an ID property.- Specified by:
getIdPropertyOrFailin interfaceDatastorePersistentEntity<T>- Returns:
- the ID property.
-
verify
public void verify()- Specified by:
verifyin interfaceorg.springframework.data.mapping.model.MutablePersistentEntity<T,DatastorePersistentProperty> - Overrides:
verifyin classorg.springframework.data.mapping.model.BasicPersistentEntity<T,DatastorePersistentProperty>
-
getDiscriminationFieldName
Description copied from interface:DatastorePersistentEntityGet the name of the field for subtype discrimination if there is one.- Specified by:
getDiscriminationFieldNamein interfaceDatastorePersistentEntity<T>- Returns:
- the name of the discrimination field.
nullif this persistent entity doesn't have one.
-
getCompatibleDiscriminationValues
Description copied from interface:DatastorePersistentEntityGet the discrimination values corresponding to this persistent entity ad its supertypes.- Specified by:
getCompatibleDiscriminationValuesin interfaceDatastorePersistentEntity<T>- Returns:
- the list of values where the first item is this entity's discrimination value
-
getDiscriminatorValue
Description copied from interface:DatastorePersistentEntityGet the discrimination value corresponding to this persistent entity type.- Specified by:
getDiscriminatorValuein interfaceDatastorePersistentEntity<T>- Returns:
- the value or
nullif there is no value for this type.
-
doWithColumnBackedProperties
public void doWithColumnBackedProperties(org.springframework.data.mapping.PropertyHandler<DatastorePersistentProperty> handler) Description copied from interface:DatastorePersistentEntityApplies the givenPropertyHandlerto allDatastorePersistentPropertycontained in thisDatastorePersistentEntitythat 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:
doWithColumnBackedPropertiesin interfaceDatastorePersistentEntity<T>- Parameters:
handler- must not be null.
-
doWithDescendantProperties
public void doWithDescendantProperties(org.springframework.data.mapping.PropertyHandler<DatastorePersistentProperty> handler) Description copied from interface:DatastorePersistentEntityApplies the givenPropertyHandlerto allDatastorePersistentPropertycontained in thisDatastorePersistentEntitythat are properties backed by descendants.- Specified by:
doWithDescendantPropertiesin interfaceDatastorePersistentEntity<T>- Parameters:
handler- must not be null.
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-