Module spring.data.cassandra
Class CassandraMappingContext
java.lang.Object
org.springframework.data.mapping.context.AbstractMappingContext<BasicCassandraPersistentEntity<?>,CassandraPersistentProperty>
org.springframework.data.cassandra.core.mapping.CassandraMappingContext
- All Implemented Interfaces:
Aware,BeanClassLoaderAware,BeanFactoryAware,InitializingBean,ApplicationContextAware,ApplicationEventPublisherAware,EnvironmentAware,MappingContext<BasicCassandraPersistentEntity<?>,CassandraPersistentProperty>
- Direct Known Subclasses:
BasicCassandraMappingContext
public class CassandraMappingContext
extends AbstractMappingContext<BasicCassandraPersistentEntity<?>,CassandraPersistentProperty>
implements ApplicationContextAware, BeanClassLoaderAware
Default implementation of a
MappingContext for Cassandra using CassandraPersistentEntity and
CassandraPersistentProperty as primary abstractions.- Author:
- Alex Shvid, Matthew T. Adams, Mark Paluch, John Blum, Jens Schauder, Vagif Zeynalov
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a newCassandraMappingContext.CassandraMappingContext(UserTypeResolver userTypeResolver, TupleTypeFactory tupleTypeFactory) Deprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionprotected Optional<BasicCassandraPersistentEntity<?>>addPersistentEntity(TypeInformation<?> typeInformation) protected <T> BasicCassandraPersistentEntity<T>createPersistentEntity(TypeInformation<T> typeInformation) protected CassandraPersistentPropertycreatePersistentProperty(Property property, BasicCassandraPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistryDeprecated, for removal: This API element is subject to removal in a future version.since 3.0.Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.Returns onlyTableentities.Returns only those entities representing a user defined type.Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.voidvoidsetApplicationContext(ApplicationContext applicationContext) voidsetBeanClassLoader(ClassLoader beanClassLoader) voidsetCodecRegistry(com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry codecRegistry) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.voidsetCustomConversions(CustomConversions customConversions) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.voidsetMapping(Mapping mapping) Sets theMapping.voidsetNamingStrategy(NamingStrategy namingStrategy) Set theNamingStrategyto use.voidsetTupleTypeFactory(TupleTypeFactory tupleTypeFactory) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.voidsetUserTypeResolver(UserTypeResolver userTypeResolver) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0.voidprotected booleanshouldCreatePersistentEntityFor(TypeInformation<?> typeInfo) booleanusesTable(com.datastax.oss.driver.api.core.CqlIdentifier name) Returns whether this mapping context has any entities mapped to the given table.booleanusesUserType(com.datastax.oss.driver.api.core.CqlIdentifier name) Returns whether this mapping context has any entities using the given user type.Methods inherited from class org.springframework.data.mapping.context.AbstractMappingContext
addPersistentEntity, afterPropertiesSet, doFindPersistentPropertyPaths, findPersistentPropertyPaths, getManagedTypes, getPersistentEntities, getPersistentEntity, getPersistentEntity, getPersistentEntity, getPersistentPropertyPath, getPersistentPropertyPath, getPersistentPropertyPath, hasPersistentEntityFor, setApplicationEventPublisher, setBeanFactory, setEnvironment, setInitialEntitySet, setManagedTypes, setSimpleTypeHolder, setStrict, shouldCreatePropertiesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.data.mapping.context.MappingContext
getRequiredPersistentEntity, getRequiredPersistentEntity, getRequiredPersistentEntity
-
Constructor Details
-
CassandraMappingContext
public CassandraMappingContext()Create a newCassandraMappingContext. -
CassandraMappingContext
@Deprecated(forRemoval=true) public CassandraMappingContext(UserTypeResolver userTypeResolver, TupleTypeFactory tupleTypeFactory) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0,UserTypeResolverandTupleTypeFactoryno longer required here as high-level type resolution went intoCassandraConverter.- Parameters:
userTypeResolver- must not be null.tupleTypeFactory- must not be null.- Since:
- 2.1
-
-
Method Details
-
initialize
public void initialize()- Overrides:
initializein classAbstractMappingContext<BasicCassandraPersistentEntity<?>,CassandraPersistentProperty>
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware- Overrides:
setApplicationContextin classAbstractMappingContext<BasicCassandraPersistentEntity<?>,CassandraPersistentProperty> - Throws:
BeansException
-
setBeanClassLoader
- Specified by:
setBeanClassLoaderin interfaceBeanClassLoaderAware
-
setCustomConversions
Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. Use custom conversion throughMappingCassandraConverter.Sets theCustomConversions.- Parameters:
customConversions- must not be null.- Since:
- 1.5
-
getCustomConversions
Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. Use custom conversion throughMappingCassandraConverter. -
setMapping
Sets theMapping.- Parameters:
mapping- must not be null.
-
getTableEntities
Returns onlyTableentities.- Since:
- 1.5
-
getUserDefinedTypeEntities
Returns only those entities representing a user defined type.- Since:
- 1.5
-
setCodecRegistry
@Deprecated(forRemoval=true) public void setCodecRegistry(com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry codecRegistry) Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. SetCodecRegistrydirectly onCassandraConverter.Sets theCodecRegistry.- Parameters:
codecRegistry- must not be null.- Since:
- 2.2
-
getCodecRegistry
@Deprecated(forRemoval=true) public com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry getCodecRegistry()Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. RetrieveCodecRegistrydirectly fromCassandraConverter. -
setNamingStrategy
Set theNamingStrategyto use.- Parameters:
namingStrategy- must not be null.- Since:
- 3.0
-
setTupleTypeFactory
Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. Tuple type creation usesDataTypes.tupleOf(DataType...)Sets theTupleTypeFactory.- Parameters:
tupleTypeFactory- must not be null.- Since:
- 2.1
-
setUserTypeResolver
Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. SetUserTypeResolverdirectly onCassandraConverter.Sets theUserTypeResolver.- Parameters:
userTypeResolver- must not be null.- Since:
- 1.5
-
getUserTypeResolver
Deprecated, for removal: This API element is subject to removal in a future version.since 3.0. RetrieveUserTypeResolverdirectly fromCassandraConverter. -
setVerifier
- Parameters:
verifier- The verifier to set.
-
getVerifier
- Returns:
- Returns the verifier.
-
addPersistentEntity
protected Optional<BasicCassandraPersistentEntity<?>> addPersistentEntity(TypeInformation<?> typeInformation) - Overrides:
addPersistentEntityin classAbstractMappingContext<BasicCassandraPersistentEntity<?>,CassandraPersistentProperty>
-
shouldCreatePersistentEntityFor
-
createPersistentEntity
protected <T> BasicCassandraPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) - Specified by:
createPersistentEntityin classAbstractMappingContext<BasicCassandraPersistentEntity<?>,CassandraPersistentProperty>
-
createPersistentProperty
protected CassandraPersistentProperty createPersistentProperty(Property property, BasicCassandraPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) - Specified by:
createPersistentPropertyin classAbstractMappingContext<BasicCassandraPersistentEntity<?>,CassandraPersistentProperty>
-
usesTable
public boolean usesTable(com.datastax.oss.driver.api.core.CqlIdentifier name) Returns whether this mapping context has any entities mapped to the given table.- Parameters:
name- must not be null.- Returns:
- true is this TableMetadata is used by a mapping.
-
usesUserType
public boolean usesUserType(com.datastax.oss.driver.api.core.CqlIdentifier name) Returns whether this mapping context has any entities using the given user type.- Parameters:
name- must not be null.- Returns:
- true is this UserType is used.
- Since:
- 1.5
-
UserTypeResolverandTupleTypeFactoryno longer required here as high-level type resolution went intoCassandraConverter.