Interface SpannerPersistentEntity<T>
- Type Parameters:
T
- the underlying persistent entity type
- All Superinterfaces:
org.springframework.context.ApplicationContextAware
,org.springframework.beans.factory.Aware
,org.springframework.context.EnvironmentAware
,Iterable<SpannerPersistentProperty>
,org.springframework.data.mapping.model.MutablePersistentEntity<T,
,SpannerPersistentProperty> org.springframework.data.mapping.PersistentEntity<T,
SpannerPersistentProperty>
- All Known Implementing Classes:
SpannerPersistentEntityImpl
public interface SpannerPersistentEntity<T>
extends org.springframework.data.mapping.model.MutablePersistentEntity<T,SpannerPersistentProperty>, org.springframework.context.ApplicationContextAware
Cloud Spanner specific interface for a
MutablePersistentEntity
stored in a Cloud Spanner
table.- Since:
- 1.1
-
Method Summary
Modifier and TypeMethodDescriptioncolumns()
Gets the column names stored for this entity.void
doWithColumnBackedProperties
(org.springframework.data.mapping.PropertyHandler<SpannerPersistentProperty> handler) Applies the givenPropertyHandler
to allSpannerPersistentProperty
s contained in thisSpannerPersistentProperty
that are stored as columns in the table for this entity.void
doWithInterleavedProperties
(org.springframework.data.mapping.PropertyHandler<SpannerPersistentProperty> handler) Applies the givenPropertyHandler
to allSpannerPersistentProperty
s contained in thisSpannerPersistentProperty
that are collections of child entities.Gets the primary key properties in order.Returns a primary key column name; if there are multiple primary key columns, returns first one.Gets the primary key properties in order.Gets a SpannerEntityProcessor that can be used to create Cloud Spanner keys from one or more persistent properties.Gets the SpannerMappingContext that can be used to create persistent entities of types that appear as properties of this entity.getWhere()
Returns the value of theWhere
annotation from the entity's class or inherited from parents or an empty string when no annotation found.boolean
Returns true if the entity has at least one eagerly load interleaved property.boolean
Returns true if the entity has a muti-field key.boolean
hasWhere()
Returns true when the entity has an annotationWhere
with a non-empty value.Gets the name of the Cloud Spanner table.Methods inherited from interface org.springframework.context.ApplicationContextAware
setApplicationContext
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, verify
Methods inherited from interface org.springframework.data.mapping.PersistentEntity
doWithAll, doWithAssociations, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getIdentifierAccessor, 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
-
Method Details
-
tableName
String tableName()Gets the name of the Cloud Spanner table.- Returns:
- the name of the table.
-
columns
Gets the column names stored for this entity.- Returns:
- the column names.
-
getPrimaryKeyProperties
SpannerPersistentProperty[] getPrimaryKeyProperties()Gets the primary key properties in order. Embedded object properties containing key parts are represented as a single property.- Returns:
- an array of the properties comprising the primary key in order.
-
getFlattenedPrimaryKeyProperties
List<SpannerPersistentProperty> getFlattenedPrimaryKeyProperties()Gets the primary key properties in order. Embedded object properties containing key parts are flattened into their multiple primary key properties.- Returns:
- an array of the properties comprising the primary key in order.
-
getSpannerMappingContext
SpannerMappingContext getSpannerMappingContext()Gets the SpannerMappingContext that can be used to create persistent entities of types that appear as properties of this entity.- Returns:
- the SpannerMappingContext instance
-
getSpannerEntityProcessor
SpannerEntityWriter getSpannerEntityProcessor()Gets a SpannerEntityProcessor that can be used to create Cloud Spanner keys from one or more persistent properties.- Returns:
- a SpannerEntityProcessor.
-
getIdProperty
SpannerCompositeKeyProperty getIdProperty()- Specified by:
getIdProperty
in interfaceorg.springframework.data.mapping.PersistentEntity<T,
SpannerPersistentProperty>
-
doWithInterleavedProperties
void doWithInterleavedProperties(org.springframework.data.mapping.PropertyHandler<SpannerPersistentProperty> handler) Applies the givenPropertyHandler
to allSpannerPersistentProperty
s contained in thisSpannerPersistentProperty
that are collections of child entities.- Parameters:
handler
- must not be null.
-
doWithColumnBackedProperties
void doWithColumnBackedProperties(org.springframework.data.mapping.PropertyHandler<SpannerPersistentProperty> handler) Applies the givenPropertyHandler
to allSpannerPersistentProperty
s contained in thisSpannerPersistentProperty
that are stored as columns in the table for this entity.- Parameters:
handler
- must not be null.
-
hasMultiFieldKey
boolean hasMultiFieldKey()Returns true if the entity has a muti-field key.- Returns:
- true if the entity has a muti-field key
-
getPrimaryKeyColumnName
String getPrimaryKeyColumnName()Returns a primary key column name; if there are multiple primary key columns, returns first one. In case of embedded keys it works recursively.- Returns:
- a primary key column name
-
hasEagerlyLoadedProperties
boolean hasEagerlyLoadedProperties()Returns true if the entity has at least one eagerly load interleaved property.- Returns:
- true if the entity has at least one eagerly load interleaved property
- See Also:
-
getWhere
String getWhere()Returns the value of theWhere
annotation from the entity's class or inherited from parents or an empty string when no annotation found.- Returns:
- the value of the
Where
from the entity's class or inherited from parents or an empty string when no annotation found. - See Also:
-
hasWhere
boolean hasWhere()Returns true when the entity has an annotationWhere
with a non-empty value.- Returns:
- true when the entity has an annotation
Where
with a non-empty value. - See Also:
-