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>, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, CassandraPersistentEntity<T>, org.springframework.data.mapping.model.MutablePersistentEntity<T,CassandraPersistentProperty>, org.springframework.data.mapping.PersistentEntity<T,CassandraPersistentProperty>
Direct Known Subclasses:
BasicCassandraPersistentTupleEntity, CassandraUserTypePersistentEntity

public class BasicCassandraPersistentEntity<T> extends org.springframework.data.mapping.model.BasicPersistentEntity<T,CassandraPersistentProperty> implements CassandraPersistentEntity<T>, org.springframework.context.ApplicationContextAware
Cassandra specific BasicPersistentEntity implementation that adds Cassandra specific metadata.
Author:
Alex Shvid, Matthew T. Adams, John Blum, Mark Paluch
  • Constructor Details

    • BasicCassandraPersistentEntity

      public BasicCassandraPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation)
      Create a new BasicCassandraPersistentEntity given TypeInformation.
      Parameters:
      typeInformation - must not be null.
    • BasicCassandraPersistentEntity

      public BasicCassandraPersistentEntity(org.springframework.data.util.TypeInformation<T> typeInformation, CassandraPersistentEntityMetadataVerifier verifier)
      Create a new BasicCassandraPersistentEntity with the given TypeInformation. 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(org.springframework.data.util.TypeInformation<T> typeInformation, CassandraPersistentEntityMetadataVerifier verifier, Comparator<CassandraPersistentProperty> comparator)
      Create a new BasicCassandraPersistentEntity with the given TypeInformation. 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

      public void addAssociation(org.springframework.data.mapping.Association<CassandraPersistentProperty> association)
      Specified by:
      addAssociation in interface org.springframework.data.mapping.model.MutablePersistentEntity<T,CassandraPersistentProperty>
      Overrides:
      addAssociation in class org.springframework.data.mapping.model.BasicPersistentEntity<T,CassandraPersistentProperty>
    • doWithAssociations

      public void doWithAssociations(org.springframework.data.mapping.AssociationHandler<CassandraPersistentProperty> handler)
      Specified by:
      doWithAssociations in interface org.springframework.data.mapping.PersistentEntity<T,CassandraPersistentProperty>
      Overrides:
      doWithAssociations in class org.springframework.data.mapping.model.BasicPersistentEntity<T,CassandraPersistentProperty>
    • isCompositePrimaryKey

      public boolean isCompositePrimaryKey()
      Description copied from interface: CassandraPersistentEntity
      Returns whether this entity represents a composite primary key.
      Specified by:
      isCompositePrimaryKey in interface CassandraPersistentEntity<T>
    • verify

      public void verify() throws org.springframework.data.mapping.MappingException
      Specified by:
      verify in interface org.springframework.data.mapping.model.MutablePersistentEntity<T,CassandraPersistentProperty>
      Overrides:
      verify in class org.springframework.data.mapping.model.BasicPersistentEntity<T,CassandraPersistentProperty>
      Throws:
      org.springframework.data.mapping.MappingException
    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext context) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • setForceQuote

      public void setForceQuote(boolean forceQuote)
      Description copied from interface: CassandraPersistentEntity
      Sets whether to enforce quoting when using the CassandraPersistentEntity.getTableName() in CQL.
      Specified by:
      setForceQuote in interface CassandraPersistentEntity<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 interface CassandraPersistentEntity<T>
      Parameters:
      tableName - must not be null.
    • setNamingStrategy

      public void setNamingStrategy(NamingStrategy namingStrategy)
      Set the NamingStrategy 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 interface CassandraPersistentEntity<T>
    • setVerifier

      public void setVerifier(CassandraPersistentEntityMetadataVerifier verifier)
      Parameters:
      verifier - The verifier to set.
    • getVerifier

      Returns:
      the verifier.
    • isTupleType

      public boolean isTupleType()
      Specified by:
      isTupleType in interface CassandraPersistentEntity<T>
      Returns:
      true if the type is a mapped tuple type.
      See Also:
    • isUserDefinedType

      public boolean isUserDefinedType()
      Specified by:
      isUserDefinedType in interface CassandraPersistentEntity<T>
      Returns:
      true if the type is a mapped user defined type.
      See Also: