public class BasicCassandraMappingContext extends org.springframework.data.mapping.context.AbstractMappingContext<CassandraPersistentEntity<?>,CassandraPersistentProperty> implements CassandraMappingContext, org.springframework.context.ApplicationContextAware
MappingContext
for Cassandra using CassandraPersistentEntity
and
CassandraPersistentProperty
as primary abstractions.Modifier and Type | Field and Description |
---|---|
protected ClassLoader |
beanClassLoader |
protected org.springframework.context.ApplicationContext |
context |
protected Map<Class<?>,CassandraPersistentEntity<?>> |
entitiesByType |
protected Map<CqlIdentifier,Set<CassandraPersistentEntity<?>>> |
entitySetsByTableName |
protected Mapping |
mapping |
protected Set<CassandraPersistentEntity<?>> |
primaryKeyEntities |
protected Set<CassandraPersistentEntity<?>> |
tableEntities |
protected Set<CassandraPersistentEntity<?>> |
userDefinedTypes |
protected CassandraPersistentEntityMetadataVerifier |
verifier |
Constructor and Description |
---|
BasicCassandraMappingContext()
Creates a new
BasicCassandraMappingContext . |
Modifier and Type | Method and Description |
---|---|
protected CassandraPersistentEntity<?> |
addPersistentEntity(org.springframework.data.util.TypeInformation<?> typeInformation) |
boolean |
contains(Class<?> type)
Returns whether this
CassandraMappingContext already contains a CassandraPersistentEntity for the
given type. |
protected <T> CassandraPersistentEntity<T> |
createPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation) |
CassandraPersistentProperty |
createPersistentProperty(Field field,
PropertyDescriptor descriptor,
CassandraPersistentEntity<?> owner,
CassandraSimpleTypeHolder simpleTypeHolder) |
CassandraPersistentProperty |
createPersistentProperty(Field field,
PropertyDescriptor descriptor,
CassandraPersistentEntity<?> owner,
org.springframework.data.mapping.model.SimpleTypeHolder simpleTypeHolder) |
CreateTableSpecification |
getCreateTableSpecificationFor(CassandraPersistentEntity<?> entity)
Returns a
CreateTableSpecification for the given entity, including all mapping information. |
CreateUserTypeSpecification |
getCreateUserTypeSpecificationFor(CassandraPersistentEntity<?> entity)
Returns a
CreateUserTypeSpecification for the given entity, including all mapping information. |
com.datastax.driver.core.DataType |
getDataType(CassandraPersistentProperty property)
Retrieve the data type of the property.
|
com.datastax.driver.core.DataType |
getDataType(Class<?> type)
Retrieve the data type based on the given
type . |
CassandraPersistentEntity<?> |
getExistingPersistentEntity(Class<?> type)
Returns the existing
CassandraPersistentEntity for the given Class . |
Collection<CassandraPersistentEntity<?>> |
getNonPrimaryKeyEntities()
Returns only those entities not representing primary key types.
|
Collection<CassandraPersistentEntity<?>> |
getPersistentEntities(boolean includePrimaryKeyTypesAndUdts)
Returns all persistent entities or only non-primary-key entities.
|
Collection<CassandraPersistentEntity<?>> |
getPrimaryKeyEntities()
Returns only those entities representing primary key types.
|
Collection<CassandraPersistentEntity<?>> |
getTableEntities()
Returns only
Table entities. |
Collection<CassandraPersistentEntity<?>> |
getUserDefinedTypeEntities()
Returns only those entities representing a user defined type.
|
CassandraPersistentEntityMetadataVerifier |
getVerifier() |
void |
initialize() |
protected void |
processMappingOverride(CassandraPersistentEntity<?> entity,
PropertyMapping mapping) |
protected void |
processMappingOverrides() |
protected void |
processMappingOverrides(CassandraPersistentEntity<?> entity,
EntityMapping entityMapping) |
void |
setApplicationContext(org.springframework.context.ApplicationContext applicationContext) |
void |
setBeanClassLoader(ClassLoader beanClassLoader) |
void |
setCustomConversions(CustomConversions customConversions)
Sets the
CustomConversions . |
void |
setMapping(Mapping mapping) |
void |
setUserTypeResolver(UserTypeResolver userTypeResolver)
Sets the
UserTypeResolver . |
void |
setVerifier(CassandraPersistentEntityMetadataVerifier verifier)
Sets a verifier other than the
BasicCassandraPersistentEntityMetadataVerifier |
protected boolean |
shouldCreatePersistentEntityFor(org.springframework.data.util.TypeInformation<?> typeInfo) |
boolean |
usesTable(com.datastax.driver.core.TableMetadata table)
Returns whether this mapping context has any entities mapped to the given table.
|
boolean |
usesUserType(com.datastax.driver.core.UserType userType)
Returns whether this mapping context has any entities using the given user type.
|
addPersistentEntity, afterPropertiesSet, getManagedTypes, getPersistentEntities, getPersistentEntity, getPersistentEntity, getPersistentEntity, getPersistentPropertyPath, getPersistentPropertyPath, getPersistentPropertyPath, hasPersistentEntityFor, setApplicationEventPublisher, setInitialEntitySet, setSimpleTypeHolder, setStrict
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPersistentEntities
protected org.springframework.context.ApplicationContext context
protected CassandraPersistentEntityMetadataVerifier verifier
protected ClassLoader beanClassLoader
protected Mapping mapping
protected Map<Class<?>,CassandraPersistentEntity<?>> entitiesByType
protected Map<CqlIdentifier,Set<CassandraPersistentEntity<?>>> entitySetsByTableName
protected Set<CassandraPersistentEntity<?>> primaryKeyEntities
protected Set<CassandraPersistentEntity<?>> userDefinedTypes
protected Set<CassandraPersistentEntity<?>> tableEntities
public BasicCassandraMappingContext()
BasicCassandraMappingContext
.public void initialize()
initialize
in class org.springframework.data.mapping.context.AbstractMappingContext<CassandraPersistentEntity<?>,CassandraPersistentProperty>
protected void processMappingOverrides()
protected void processMappingOverrides(CassandraPersistentEntity<?> entity, EntityMapping entityMapping)
protected void processMappingOverride(CassandraPersistentEntity<?> entity, PropertyMapping mapping)
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
setApplicationContext
in interface org.springframework.context.ApplicationContextAware
org.springframework.beans.BeansException
public void setBeanClassLoader(ClassLoader beanClassLoader)
public void setCustomConversions(CustomConversions customConversions)
CustomConversions
.customConversions
- must not be null.public void setMapping(Mapping mapping)
public void setUserTypeResolver(UserTypeResolver userTypeResolver)
UserTypeResolver
.userTypeResolver
- must not be null.public void setVerifier(CassandraPersistentEntityMetadataVerifier verifier)
CassandraMappingContext
BasicCassandraPersistentEntityMetadataVerifier
setVerifier
in interface CassandraMappingContext
verifier
- The verifier to set.public CassandraPersistentEntityMetadataVerifier getVerifier()
public Collection<CassandraPersistentEntity<?>> getNonPrimaryKeyEntities()
CassandraMappingContext
getNonPrimaryKeyEntities
in interface CassandraMappingContext
CassandraMappingContext.getPersistentEntities(boolean)
public Collection<CassandraPersistentEntity<?>> getPrimaryKeyEntities()
CassandraMappingContext
getPrimaryKeyEntities
in interface CassandraMappingContext
public Collection<CassandraPersistentEntity<?>> getTableEntities()
CassandraMappingContext
Table
entities.getTableEntities
in interface CassandraMappingContext
public Collection<CassandraPersistentEntity<?>> getUserDefinedTypeEntities()
CassandraMappingContext
getUserDefinedTypeEntities
in interface CassandraMappingContext
CassandraMappingContext.getPersistentEntities(boolean)
public Collection<CassandraPersistentEntity<?>> getPersistentEntities(boolean includePrimaryKeyTypesAndUdts)
CassandraMappingContext
getPersistentEntities
in interface CassandraMappingContext
includePrimaryKeyTypesAndUdts
- If true, returns all entities, including entities that represent primary
key types and user-defined types. If false, returns only entities that don't represent primary key types and no user-defined types.protected <T> CassandraPersistentEntity<T> createPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
createPersistentEntity
in class org.springframework.data.mapping.context.AbstractMappingContext<CassandraPersistentEntity<?>,CassandraPersistentProperty>
public CassandraPersistentProperty createPersistentProperty(Field field, PropertyDescriptor descriptor, CassandraPersistentEntity<?> owner, org.springframework.data.mapping.model.SimpleTypeHolder simpleTypeHolder)
createPersistentProperty
in class org.springframework.data.mapping.context.AbstractMappingContext<CassandraPersistentEntity<?>,CassandraPersistentProperty>
public CassandraPersistentProperty createPersistentProperty(Field field, PropertyDescriptor descriptor, CassandraPersistentEntity<?> owner, CassandraSimpleTypeHolder simpleTypeHolder)
public boolean usesTable(com.datastax.driver.core.TableMetadata table)
CassandraMappingContext
usesTable
in interface CassandraMappingContext
table
- must not be null.public boolean usesUserType(com.datastax.driver.core.UserType userType)
CassandraMappingContext
usesUserType
in interface CassandraMappingContext
userType
- must not be null.public CreateTableSpecification getCreateTableSpecificationFor(CassandraPersistentEntity<?> entity)
CassandraMappingContext
CreateTableSpecification
for the given entity, including all mapping information.getCreateTableSpecificationFor
in interface CassandraMappingContext
entity
- must not be null.public CreateUserTypeSpecification getCreateUserTypeSpecificationFor(CassandraPersistentEntity<?> entity)
CassandraMappingContext
CreateUserTypeSpecification
for the given entity, including all mapping information.getCreateUserTypeSpecificationFor
in interface CassandraMappingContext
entity
- must not be null.protected boolean shouldCreatePersistentEntityFor(org.springframework.data.util.TypeInformation<?> typeInfo)
shouldCreatePersistentEntityFor
in class org.springframework.data.mapping.context.AbstractMappingContext<CassandraPersistentEntity<?>,CassandraPersistentProperty>
protected CassandraPersistentEntity<?> addPersistentEntity(org.springframework.data.util.TypeInformation<?> typeInformation)
addPersistentEntity
in class org.springframework.data.mapping.context.AbstractMappingContext<CassandraPersistentEntity<?>,CassandraPersistentProperty>
public com.datastax.driver.core.DataType getDataType(CassandraPersistentProperty property)
CassandraMappingContext
types
are determined using simple types and
configured CustomConversions
.getDataType
in interface CassandraMappingContext
property
- must not be null.type
.CustomConversions
,
CassandraSimpleTypeHolder
public com.datastax.driver.core.DataType getDataType(Class<?> type)
CassandraMappingContext
type
. Cassandra types
are determined using simple types and
configured CustomConversions
.getDataType
in interface CassandraMappingContext
type
- must not be null.type
.CustomConversions
,
CassandraSimpleTypeHolder
public CassandraPersistentEntity<?> getExistingPersistentEntity(Class<?> type)
CassandraMappingContext
CassandraPersistentEntity
for the given Class
. If it is not yet known to this
CassandraMappingContext
, an IllegalArgumentException
is thrown.getExistingPersistentEntity
in interface CassandraMappingContext
type
- The class of the existing persistent entity.public boolean contains(Class<?> type)
CassandraMappingContext
CassandraMappingContext
already contains a CassandraPersistentEntity
for the
given type.contains
in interface CassandraMappingContext
Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.