Module spring.data.cassandra
Class BasicCassandraPersistentEntity<T>
java.lang.Object
org.springframework.data.mapping.model.BasicPersistentEntity<T,CassandraPersistentProperty>
org.springframework.data.cassandra.core.mapping.BasicCassandraPersistentEntity<T>
- All Implemented Interfaces:
Iterable<CassandraPersistentProperty>,Aware,ApplicationContextAware,EnvironmentAware,CassandraPersistentEntity<T>,MutablePersistentEntity<T,,CassandraPersistentProperty> PersistentEntity<T,CassandraPersistentProperty>
- Direct Known Subclasses:
BasicCassandraPersistentTupleEntity,CassandraUserTypePersistentEntity
public class BasicCassandraPersistentEntity<T>
extends BasicPersistentEntity<T,CassandraPersistentProperty>
implements CassandraPersistentEntity<T>, ApplicationContextAware
Cassandra specific
BasicPersistentEntity implementation that adds Cassandra specific metadata.- Author:
- Alex Shvid, Matthew T. Adams, John Blum, Mark Paluch
-
Constructor Summary
ConstructorsModifierConstructorDescriptionBasicCassandraPersistentEntity(TypeInformation<T> typeInformation) Create a newBasicCassandraPersistentEntitygivenTypeInformation.BasicCassandraPersistentEntity(TypeInformation<T> typeInformation, CassandraPersistentEntityMetadataVerifier verifier) Create a newBasicCassandraPersistentEntitywith the givenTypeInformation.protectedBasicCassandraPersistentEntity(TypeInformation<T> typeInformation, CassandraPersistentEntityMetadataVerifier verifier, Comparator<CassandraPersistentProperty> comparator) Create a newBasicCassandraPersistentEntitywith the givenTypeInformation. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAssociation(Association<CassandraPersistentProperty> association) protected com.datastax.oss.driver.api.core.CqlIdentifierprotected com.datastax.oss.driver.api.core.CqlIdentifiervoidprotected EvaluationContextgetEvaluationContext(Object rootObject) protected EvaluationContextgetEvaluationContext(Object rootObject, ExpressionDependencies dependencies) com.datastax.oss.driver.api.core.CqlIdentifierReturns a specific keyspace to which the entity shall be persisted.getProperty(Parameter<?, CassandraPersistentProperty> parameter) com.datastax.oss.driver.api.core.CqlIdentifierReturns the table name to which the entity shall be persisted.protected ValueEvaluationContextgetValueEvaluationContext(Object rootObject) protected ValueEvaluationContextgetValueEvaluationContext(Object rootObject, ExpressionDependencies dependencies) booleanReturns whether this entity represents a composite primary key.booleanbooleanvoidsetApplicationContext(ApplicationContext context) voidsetForceQuote(boolean forceQuote) Sets whether to enforce quoting when using theCassandraPersistentEntity.getTableName()in CQL.voidsetKeyspace(com.datastax.oss.driver.api.core.CqlIdentifier keyspace) Sets the CQL keyspace.voidsetNamingStrategy(NamingStrategy namingStrategy) Set theNamingStrategyto use.voidsetTableName(com.datastax.oss.driver.api.core.CqlIdentifier tableName) Sets the CQL table name.voidtoString()voidverify()Methods inherited from class org.springframework.data.mapping.model.BasicPersistentEntity
addPersistentProperty, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getFallbackIsNewStrategy, getIdentifierAccessor, getIdProperty, getInstanceCreatorMetadata, getName, getPersistenceConstructor, getPersistentProperties, getPersistentProperty, getPropertyAccessor, getPropertyPathAccessor, getType, getTypeAlias, getTypeInformation, getVersionProperty, hasIdProperty, hasVersionProperty, isAnnotationPresent, isCreatorArgument, isIdProperty, isImmutable, isNew, isVersionProperty, iterator, requiresPropertyPopulation, returnPropertyIfBetterIdPropertyCandidateOrNull, setEnvironment, setEvaluationContextProvider, setPersistentPropertyAccessorFactoryMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.data.cassandra.core.mapping.CassandraPersistentEntity
getRequiredKeyspace, hasKeyspace, setTableNameMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface org.springframework.data.mapping.PersistentEntity
doWithAll, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getIdentifierAccessor, getIdProperty, 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
-
Constructor Details
-
BasicCassandraPersistentEntity
Create a newBasicCassandraPersistentEntitygivenTypeInformation.- Parameters:
typeInformation- must not be null.
-
BasicCassandraPersistentEntity
public BasicCassandraPersistentEntity(TypeInformation<T> typeInformation, CassandraPersistentEntityMetadataVerifier verifier) Create a newBasicCassandraPersistentEntitywith the givenTypeInformation. Will default the table name to the entity's simple type name.- Parameters:
typeInformation- must not be null.verifier- must not be null.
-
BasicCassandraPersistentEntity
protected BasicCassandraPersistentEntity(TypeInformation<T> typeInformation, CassandraPersistentEntityMetadataVerifier verifier, Comparator<CassandraPersistentProperty> comparator) Create a newBasicCassandraPersistentEntitywith the givenTypeInformation. Will default the table name to the entity's simple type name.- Parameters:
typeInformation- must not be null.verifier- must not be null.comparator- must not be null.- Since:
- 2.1
-
-
Method Details
-
determineTableName
protected com.datastax.oss.driver.api.core.CqlIdentifier determineTableName() -
determineKeyspace
-
getEvaluationContext
- Overrides:
getEvaluationContextin classBasicPersistentEntity<T,CassandraPersistentProperty>
-
getEvaluationContext
protected EvaluationContext getEvaluationContext(Object rootObject, ExpressionDependencies dependencies) - Overrides:
getEvaluationContextin classBasicPersistentEntity<T,CassandraPersistentProperty>
-
getValueEvaluationContext
- Overrides:
getValueEvaluationContextin classBasicPersistentEntity<T,CassandraPersistentProperty>
-
getValueEvaluationContext
protected ValueEvaluationContext getValueEvaluationContext(Object rootObject, ExpressionDependencies dependencies) - Overrides:
getValueEvaluationContextin classBasicPersistentEntity<T,CassandraPersistentProperty>
-
addAssociation
- Specified by:
addAssociationin interfaceMutablePersistentEntity<T,CassandraPersistentProperty> - Overrides:
addAssociationin classBasicPersistentEntity<T,CassandraPersistentProperty>
-
doWithAssociations
- Specified by:
doWithAssociationsin interfacePersistentEntity<T,CassandraPersistentProperty> - Overrides:
doWithAssociationsin classBasicPersistentEntity<T,CassandraPersistentProperty>
-
isCompositePrimaryKey
public boolean isCompositePrimaryKey()Description copied from interface:CassandraPersistentEntityReturns whether this entity represents a composite primary key.- Specified by:
isCompositePrimaryKeyin interfaceCassandraPersistentEntity<T>
-
verify
- Specified by:
verifyin interfaceMutablePersistentEntity<T,CassandraPersistentProperty> - Overrides:
verifyin classBasicPersistentEntity<T,CassandraPersistentProperty> - Throws:
MappingException
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware- Throws:
BeansException
-
setForceQuote
public void setForceQuote(boolean forceQuote) Description copied from interface:CassandraPersistentEntitySets whether to enforce quoting when using theCassandraPersistentEntity.getTableName()in CQL.- Specified by:
setForceQuotein interfaceCassandraPersistentEntity<T>- Parameters:
forceQuote- true to enforce quoting; false to disable enforced quoting usage.- See Also:
-
CqlIdentifier.fromInternal(String)
-
getKeyspace
Description copied from interface:CassandraPersistentEntityReturns a specific keyspace to which the entity shall be persisted. If the entity isn't associated with a specific keyspace, then the entity is persisted in the keyspace associated with the Cassandra session.- Specified by:
getKeyspacein interfaceCassandraPersistentEntity<T>
-
setKeyspace
public void setKeyspace(com.datastax.oss.driver.api.core.CqlIdentifier keyspace) Description copied from interface:CassandraPersistentEntitySets the CQL keyspace.- Specified by:
setKeyspacein interfaceCassandraPersistentEntity<T>- Parameters:
keyspace- must not be null.
-
getTableName
public com.datastax.oss.driver.api.core.CqlIdentifier getTableName()Description copied from interface:CassandraPersistentEntityReturns the table name to which the entity shall be persisted.- Specified by:
getTableNamein interfaceCassandraPersistentEntity<T>
-
setTableName
public void setTableName(com.datastax.oss.driver.api.core.CqlIdentifier tableName) Description copied from interface:CassandraPersistentEntitySets the CQL table name.- Specified by:
setTableNamein interfaceCassandraPersistentEntity<T>- Parameters:
tableName- must not be null.
-
setNamingStrategy
Set theNamingStrategyto use.- Parameters:
namingStrategy- must not be null.- Since:
- 3.0
-
setVerifier
- Parameters:
verifier- The verifier to set.
-
getVerifier
- Returns:
- the verifier.
-
isTupleType
public boolean isTupleType()- Specified by:
isTupleTypein interfaceCassandraPersistentEntity<T>- Returns:
- true if the type is a mapped tuple type.
- See Also:
-
isUserDefinedType
public boolean isUserDefinedType()- Specified by:
isUserDefinedTypein interfaceCassandraPersistentEntity<T>- Returns:
- true if the type is a mapped user defined type.
- See Also:
-
getProperty
Description copied from interface:CassandraPersistentEntityRetrieve aCassandraPersistentPropertyfrom apersistence creator (constructor/factory method) parameter. Parameters are either derived by name or synthesized if their name does not map to a existing property.- Specified by:
getPropertyin interfaceCassandraPersistentEntity<T>- Parameters:
parameter- the parameter to create a property from. Parameters without a name return no (null) parameter.- Returns:
- the property, synthetic property or null, if the parameter is unnamed.
-
toString
-