public class BasicCassandraMappingContext extends AbstractMappingContext<CassandraPersistentEntity<?>,CassandraPersistentProperty> implements CassandraMappingContext, ApplicationContextAware
MappingContext for Cassandra using CassandraPersistentEntity and
CassandraPersistentProperty as primary abstractions.| Modifier and Type | Field and Description |
|---|---|
protected ClassLoader |
beanClassLoader |
protected 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(TypeInformation<?> typeInformation) |
boolean |
contains(Class<?> type)
Returns whether this
CassandraMappingContext already contains a CassandraPersistentEntity for the
given type. |
protected <T> CassandraPersistentEntity<T> |
createPersistentEntity(TypeInformation<T> typeInformation) |
CassandraPersistentProperty |
createPersistentProperty(Field field,
PropertyDescriptor descriptor,
CassandraPersistentEntity<?> owner,
CassandraSimpleTypeHolder simpleTypeHolder) |
CassandraPersistentProperty |
createPersistentProperty(Field field,
PropertyDescriptor descriptor,
CassandraPersistentEntity<?> owner,
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(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(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(CqlIdentifier userType)
Returns whether this mapping context has any entities using the given user type.
|
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, setStrictclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetPersistentEntitiesgetManagedTypes, getPersistentEntity, getPersistentEntity, getPersistentEntity, getPersistentPropertyPath, getPersistentPropertyPath, getPersistentPropertyPath, hasPersistentEntityForprotected 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 AbstractMappingContext<CassandraPersistentEntity<?>,CassandraPersistentProperty>protected void processMappingOverrides()
protected void processMappingOverrides(CassandraPersistentEntity<?> entity, EntityMapping entityMapping)
protected void processMappingOverride(CassandraPersistentEntity<?> entity, PropertyMapping mapping)
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext in interface ApplicationContextAwareBeansExceptionpublic 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)
CassandraMappingContextBasicCassandraPersistentEntityMetadataVerifiersetVerifier in interface CassandraMappingContextverifier - The verifier to set.public CassandraPersistentEntityMetadataVerifier getVerifier()
public Collection<CassandraPersistentEntity<?>> getNonPrimaryKeyEntities()
CassandraMappingContextgetNonPrimaryKeyEntities in interface CassandraMappingContextCassandraMappingContext.getPersistentEntities(boolean)public Collection<CassandraPersistentEntity<?>> getPrimaryKeyEntities()
CassandraMappingContextgetPrimaryKeyEntities in interface CassandraMappingContextpublic Collection<CassandraPersistentEntity<?>> getTableEntities()
CassandraMappingContextTable entities.getTableEntities in interface CassandraMappingContextpublic Collection<CassandraPersistentEntity<?>> getUserDefinedTypeEntities()
CassandraMappingContextgetUserDefinedTypeEntities in interface CassandraMappingContextCassandraMappingContext.getPersistentEntities(boolean)public Collection<CassandraPersistentEntity<?>> getPersistentEntities(boolean includePrimaryKeyTypesAndUdts)
CassandraMappingContextgetPersistentEntities in interface CassandraMappingContextincludePrimaryKeyTypesAndUdts - 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(TypeInformation<T> typeInformation)
createPersistentEntity in class AbstractMappingContext<CassandraPersistentEntity<?>,CassandraPersistentProperty>public CassandraPersistentProperty createPersistentProperty(Field field, PropertyDescriptor descriptor, CassandraPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder)
createPersistentProperty in class AbstractMappingContext<CassandraPersistentEntity<?>,CassandraPersistentProperty>public CassandraPersistentProperty createPersistentProperty(Field field, PropertyDescriptor descriptor, CassandraPersistentEntity<?> owner, CassandraSimpleTypeHolder simpleTypeHolder)
public boolean usesTable(com.datastax.driver.core.TableMetadata table)
CassandraMappingContextusesTable in interface CassandraMappingContexttable - must not be null.public boolean usesUserType(com.datastax.driver.core.UserType userType)
CassandraMappingContextusesUserType in interface CassandraMappingContextuserType - must not be null.public boolean usesUserType(CqlIdentifier userType)
CassandraMappingContextusesUserType in interface CassandraMappingContextuserType - must not be null.public CreateTableSpecification getCreateTableSpecificationFor(CassandraPersistentEntity<?> entity)
CassandraMappingContextCreateTableSpecification for the given entity, including all mapping information.getCreateTableSpecificationFor in interface CassandraMappingContextentity - must not be null.public CreateUserTypeSpecification getCreateUserTypeSpecificationFor(CassandraPersistentEntity<?> entity)
CassandraMappingContextCreateUserTypeSpecification for the given entity, including all mapping information.getCreateUserTypeSpecificationFor in interface CassandraMappingContextentity - must not be null.protected boolean shouldCreatePersistentEntityFor(TypeInformation<?> typeInfo)
shouldCreatePersistentEntityFor in class AbstractMappingContext<CassandraPersistentEntity<?>,CassandraPersistentProperty>protected CassandraPersistentEntity<?> addPersistentEntity(TypeInformation<?> typeInformation)
addPersistentEntity in class AbstractMappingContext<CassandraPersistentEntity<?>,CassandraPersistentProperty>public com.datastax.driver.core.DataType getDataType(CassandraPersistentProperty property)
CassandraMappingContexttypes are determined using simple types and
configured CustomConversions.getDataType in interface CassandraMappingContextproperty - must not be null.type.CustomConversions,
CassandraSimpleTypeHolderpublic com.datastax.driver.core.DataType getDataType(Class<?> type)
CassandraMappingContexttype. Cassandra types are determined using simple types and
configured CustomConversions.getDataType in interface CassandraMappingContexttype - must not be null.type.CustomConversions,
CassandraSimpleTypeHolderpublic CassandraPersistentEntity<?> getExistingPersistentEntity(Class<?> type)
CassandraMappingContextCassandraPersistentEntity for the given Class. If it is not yet known to this
CassandraMappingContext, an IllegalArgumentException is thrown.getExistingPersistentEntity in interface CassandraMappingContexttype - The class of the existing persistent entity.public boolean contains(Class<?> type)
CassandraMappingContextCassandraMappingContext already contains a CassandraPersistentEntity for the
given type.contains in interface CassandraMappingContextCopyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.