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
,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 newBasicCassandraPersistentEntity
givenTypeInformation
.BasicCassandraPersistentEntity
(TypeInformation<T> typeInformation, CassandraPersistentEntityMetadataVerifier verifier) Create a newBasicCassandraPersistentEntity
with the givenTypeInformation
.protected
BasicCassandraPersistentEntity
(TypeInformation<T> typeInformation, CassandraPersistentEntityMetadataVerifier verifier, Comparator<CassandraPersistentProperty> comparator) Create a newBasicCassandraPersistentEntity
with the givenTypeInformation
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAssociation
(Association<CassandraPersistentProperty> association) protected com.datastax.oss.driver.api.core.CqlIdentifier
void
com.datastax.oss.driver.api.core.CqlIdentifier
Returns the table name to which the entity shall be persisted.boolean
Returns whether this entity represents a composite primary key.boolean
boolean
void
setApplicationContext
(ApplicationContext context) void
setForceQuote
(boolean forceQuote) Sets whether to enforce quoting when using theCassandraPersistentEntity.getTableName()
in CQL.void
setNamingStrategy
(NamingStrategy namingStrategy) Set theNamingStrategy
to use.void
setTableName
(com.datastax.oss.driver.api.core.CqlIdentifier tableName) Sets the CQL table name.void
void
verify()
Methods inherited from class org.springframework.data.mapping.model.BasicPersistentEntity
addPersistentProperty, doWithAssociations, doWithProperties, doWithProperties, findAnnotation, getEvaluationContext, getEvaluationContext, 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, setEvaluationContextProvider, setPersistentPropertyAccessorFactory
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.cassandra.core.mapping.CassandraPersistentEntity
setTableName
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods 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 newBasicCassandraPersistentEntity
givenTypeInformation
.- Parameters:
typeInformation
- must not be null.
-
BasicCassandraPersistentEntity
public BasicCassandraPersistentEntity(TypeInformation<T> typeInformation, CassandraPersistentEntityMetadataVerifier verifier) Create a newBasicCassandraPersistentEntity
with 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 newBasicCassandraPersistentEntity
with 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() -
addAssociation
- Specified by:
addAssociation
in interfaceMutablePersistentEntity<T,
CassandraPersistentProperty> - Overrides:
addAssociation
in classBasicPersistentEntity<T,
CassandraPersistentProperty>
-
doWithAssociations
- Specified by:
doWithAssociations
in interfacePersistentEntity<T,
CassandraPersistentProperty> - Overrides:
doWithAssociations
in classBasicPersistentEntity<T,
CassandraPersistentProperty>
-
isCompositePrimaryKey
public boolean isCompositePrimaryKey()Description copied from interface:CassandraPersistentEntity
Returns whether this entity represents a composite primary key.- Specified by:
isCompositePrimaryKey
in interfaceCassandraPersistentEntity<T>
-
verify
- Specified by:
verify
in interfaceMutablePersistentEntity<T,
CassandraPersistentProperty> - Overrides:
verify
in classBasicPersistentEntity<T,
CassandraPersistentProperty> - Throws:
MappingException
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
- Throws:
BeansException
-
setForceQuote
public void setForceQuote(boolean forceQuote) Description copied from interface:CassandraPersistentEntity
Sets whether to enforce quoting when using theCassandraPersistentEntity.getTableName()
in CQL.- Specified by:
setForceQuote
in interfaceCassandraPersistentEntity<T>
- Parameters:
forceQuote
- true to enforce quoting; false to disable enforced quoting usage.- See Also:
-
CqlIdentifier.fromInternal(String)
-
setTableName
public void setTableName(com.datastax.oss.driver.api.core.CqlIdentifier tableName) Description copied from interface:CassandraPersistentEntity
Sets the CQL table name.- Specified by:
setTableName
in interfaceCassandraPersistentEntity<T>
- Parameters:
tableName
- must not be null.
-
setNamingStrategy
Set theNamingStrategy
to use.- Parameters:
namingStrategy
- must not be null.- Since:
- 3.0
-
getTableName
public com.datastax.oss.driver.api.core.CqlIdentifier getTableName()Description copied from interface:CassandraPersistentEntity
Returns the table name to which the entity shall be persisted.- Specified by:
getTableName
in interfaceCassandraPersistentEntity<T>
-
setVerifier
- Parameters:
verifier
- The verifier to set.
-
getVerifier
- Returns:
- the verifier.
-
isTupleType
public boolean isTupleType()- Specified by:
isTupleType
in interfaceCassandraPersistentEntity<T>
- Returns:
- true if the type is a mapped tuple type.
- See Also:
-
isUserDefinedType
public boolean isUserDefinedType()- Specified by:
isUserDefinedType
in interfaceCassandraPersistentEntity<T>
- Returns:
- true if the type is a mapped user defined type.
- See Also:
-