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
,InitializingBean
,ApplicationContextAware
,ApplicationEventPublisherAware
,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. -
Method Summary
Modifier and TypeMethodDescriptionprotected Optional<BasicCassandraPersistentEntity<?>>
addPersistentEntity
(TypeInformation<?> typeInformation) protected <T> BasicCassandraPersistentEntity<T>
createPersistentEntity
(TypeInformation<T> typeInformation) protected CassandraPersistentProperty
createPersistentProperty
(Property property, BasicCassandraPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry
Deprecated.since 3.0.Deprecated.since 3.0.Returns onlyTable
entities.Returns only those entities representing a user defined type.Deprecated.since 3.0.void
void
setApplicationContext
(ApplicationContext applicationContext) void
setBeanClassLoader
(ClassLoader beanClassLoader) void
setCodecRegistry
(com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry codecRegistry) Deprecated.since 3.0.void
setCustomConversions
(CustomConversions customConversions) Deprecated.since 3.0.void
setMapping
(Mapping mapping) Sets theMapping
.void
setNamingStrategy
(NamingStrategy namingStrategy) Set theNamingStrategy
to use.void
setTupleTypeFactory
(TupleTypeFactory tupleTypeFactory) Deprecated.since 3.0.void
setUserTypeResolver
(UserTypeResolver userTypeResolver) Deprecated.since 3.0.void
protected boolean
shouldCreatePersistentEntityFor
(TypeInformation<?> typeInfo) boolean
usesTable
(com.datastax.oss.driver.api.core.CqlIdentifier name) Returns whether this mapping context has any entities mapped to the given table.boolean
usesUserType
(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, hasPersistentEntityFor, setApplicationEventPublisher, setInitialEntitySet, setSimpleTypeHolder, setStrict
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
-
CassandraMappingContext
public CassandraMappingContext()Create a newCassandraMappingContext
. -
CassandraMappingContext
@Deprecated public CassandraMappingContext(UserTypeResolver userTypeResolver, TupleTypeFactory tupleTypeFactory) Deprecated.since 3.0,UserTypeResolver
andTupleTypeFactory
no 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:
initialize
in classAbstractMappingContext<BasicCassandraPersistentEntity<?>,
CassandraPersistentProperty>
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Overrides:
setApplicationContext
in classAbstractMappingContext<BasicCassandraPersistentEntity<?>,
CassandraPersistentProperty> - Throws:
BeansException
-
setBeanClassLoader
- Specified by:
setBeanClassLoader
in interfaceBeanClassLoaderAware
-
setCustomConversions
Deprecated.since 3.0. Use custom conversion throughMappingCassandraConverter
.Sets theCustomConversions
.- Parameters:
customConversions
- must not be null.- Since:
- 1.5
-
getCustomConversions
Deprecated.since 3.0. Use custom conversion throughMappingCassandraConverter
. -
setMapping
Sets theMapping
.- Parameters:
mapping
- must not be null.
-
getTableEntities
Returns onlyTable
entities.- Since:
- 1.5
-
getUserDefinedTypeEntities
Returns only those entities representing a user defined type.- Since:
- 1.5
-
setCodecRegistry
@Deprecated public void setCodecRegistry(com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry codecRegistry) Deprecated.since 3.0. SetCodecRegistry
directly onCassandraConverter
.Sets theCodecRegistry
.- Parameters:
codecRegistry
- must not be null.- Since:
- 2.2
-
getCodecRegistry
@Deprecated public com.datastax.oss.driver.api.core.type.codec.registry.CodecRegistry getCodecRegistry()Deprecated.since 3.0. RetrieveCodecRegistry
directly fromCassandraConverter
. -
setNamingStrategy
Set theNamingStrategy
to use.- Parameters:
namingStrategy
- must not be null.- Since:
- 3.0
-
setTupleTypeFactory
Deprecated.since 3.0. Tuple type creation usesDataTypes.tupleOf(DataType...)
Sets theTupleTypeFactory
.- Parameters:
tupleTypeFactory
- must not be null.- Since:
- 2.1
-
setUserTypeResolver
Deprecated.since 3.0. SetUserTypeResolver
directly onCassandraConverter
.Sets theUserTypeResolver
.- Parameters:
userTypeResolver
- must not be null.- Since:
- 1.5
-
getUserTypeResolver
Deprecated.since 3.0. RetrieveUserTypeResolver
directly fromCassandraConverter
. -
setVerifier
- Parameters:
verifier
- The verifier to set.
-
getVerifier
- Returns:
- Returns the verifier.
-
addPersistentEntity
protected Optional<BasicCassandraPersistentEntity<?>> addPersistentEntity(TypeInformation<?> typeInformation) - Overrides:
addPersistentEntity
in classAbstractMappingContext<BasicCassandraPersistentEntity<?>,
CassandraPersistentProperty>
-
shouldCreatePersistentEntityFor
-
createPersistentEntity
protected <T> BasicCassandraPersistentEntity<T> createPersistentEntity(TypeInformation<T> typeInformation) - Specified by:
createPersistentEntity
in classAbstractMappingContext<BasicCassandraPersistentEntity<?>,
CassandraPersistentProperty>
-
createPersistentProperty
protected CassandraPersistentProperty createPersistentProperty(Property property, BasicCassandraPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) - Specified by:
createPersistentProperty
in 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
-
UserTypeResolver
andTupleTypeFactory
no longer required here as high-level type resolution went intoCassandraConverter
.