Class BasicCassandraPersistentProperty
java.lang.Object
org.springframework.data.mapping.model.AbstractPersistentProperty<P>
org.springframework.data.mapping.model.AnnotationBasedPersistentProperty<CassandraPersistentProperty>
org.springframework.data.cassandra.core.mapping.BasicCassandraPersistentProperty
- All Implemented Interfaces:
Aware,ApplicationContextAware,CassandraPersistentProperty,PersistentProperty<CassandraPersistentProperty>
- Direct Known Subclasses:
BasicCassandraPersistentTupleProperty,CachingCassandraPersistentProperty
public class BasicCassandraPersistentProperty
extends AnnotationBasedPersistentProperty<CassandraPersistentProperty>
implements CassandraPersistentProperty, ApplicationContextAware
Cassandra specific
AnnotationBasedPersistentProperty implementation.- Author:
- Alex Shvid, Matthew T. Adams, Antoine Toulme, Mark Paluch, John Blum, Aleksei Zotov
-
Constructor Summary
ConstructorsConstructorDescriptionBasicCassandraPersistentProperty(Property property, CassandraPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) Create a newBasicCassandraPersistentProperty. -
Method Summary
Modifier and TypeMethodDescriptionprotected Association<CassandraPersistentProperty>findAnnotatedType(Class<? extends Annotation> annotationType) Find anAnnotatedTypebyannotationTypederived from the property type.com.datastax.oss.driver.api.core.CqlIdentifierThe name of the single column to which the property is persisted.The name of the element ordinal to which the property is persisted when the owning type is a mapped tuple.getOwner()The ordering (ascending or descending) for the column.booleanReturn whether the property has an explicitly configured column name.booleanWhether the property is a cluster key column.booleanWhether the property is a composite primary key.booleanReturns whether the property is aMap.booleanWhether the property is a partition key column.booleanWhether the property is a partition key column or a cluster key columnbooleanWhether the property maps to a static column.voidsetApplicationContext(ApplicationContext context) voidsetColumnName(com.datastax.oss.driver.api.core.CqlIdentifier columnName) If this property is mapped with a single column, set the column name to the givenCqlIdentifier.voidsetForceQuote(boolean forceQuote) Whether to force-quote the column names of this property.voidsetNamingStrategy(NamingStrategy namingStrategy) Set theNamingStrategyto use.Methods inherited from class org.springframework.data.mapping.model.AnnotationBasedPersistentProperty
findAnnotation, findPropertyOrOwnerAnnotation, getAssociationTargetTypeInformation, getSpelExpression, isAnnotationPresent, isAssociation, isIdProperty, isTransient, isVersionProperty, isWritable, toString, usePropertyAccessMethods inherited from class org.springframework.data.mapping.model.AbstractPersistentProperty
equals, getActualType, getActualTypeInformation, getAssociationTargetType, getComponentType, getField, getGetter, getMapValueType, getName, getPersistentEntityTypeInformation, getProperty, getRawType, getSetter, getType, getTypeInformation, getWither, hashCode, isArray, isCollectionLike, isEntity, isImmutable, isMapMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty
getRequiredColumnName, getRequiredOrdinal, hasOrdinal, isEmbedded, setColumnNameMethods inherited from interface org.springframework.data.mapping.PersistentProperty
findAnnotation, findPropertyOrOwnerAnnotation, getAccessorForOwner, getActualType, getAssociationTargetType, getAssociationTargetTypeInformation, getComponentType, getField, getGetter, getMapValueType, getName, getPersistentEntityTypeInformation, getRawType, getRequiredAnnotation, getRequiredAssociation, getRequiredField, getRequiredGetter, getRequiredSetter, getRequiredWither, getSetter, getSpelExpression, getType, getTypeInformation, getWither, hasActualTypeAnnotation, isAnnotationPresent, isArray, isAssociation, isCollectionLike, isEntity, isIdProperty, isImmutable, isMap, isTransient, isVersionProperty, isWritable, usePropertyAccess
-
Constructor Details
-
BasicCassandraPersistentProperty
public BasicCassandraPersistentProperty(Property property, CassandraPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) Create a newBasicCassandraPersistentProperty.- Parameters:
property- the actualPropertyin the domain entity corresponding to this persistent entity.owner- the containing object orCassandraPersistentEntityof this persistent property.simpleTypeHolder- mapping of Java [simple|wrapper] types to Cassandra data types.
-
-
Method Details
-
setApplicationContext
- Specified by:
setApplicationContextin interfaceApplicationContextAware
-
getOwner
- Specified by:
getOwnerin interfacePersistentProperty<CassandraPersistentProperty>- Overrides:
getOwnerin classAbstractPersistentProperty<CassandraPersistentProperty>
-
getColumnName
public com.datastax.oss.driver.api.core.CqlIdentifier getColumnName()Description copied from interface:CassandraPersistentPropertyThe name of the single column to which the property is persisted.- Specified by:
getColumnNamein interfaceCassandraPersistentProperty
-
getOrdinal
Description copied from interface:CassandraPersistentPropertyThe name of the element ordinal to which the property is persisted when the owning type is a mapped tuple.- Specified by:
getOrdinalin interfaceCassandraPersistentProperty
-
getPrimaryKeyOrdering
Description copied from interface:CassandraPersistentPropertyThe ordering (ascending or descending) for the column. Valid only for primary key columns; returns null for non-primary key columns.- Specified by:
getPrimaryKeyOrderingin interfaceCassandraPersistentProperty
-
isCompositePrimaryKey
public boolean isCompositePrimaryKey()Description copied from interface:CassandraPersistentPropertyWhether the property is a composite primary key.- Specified by:
isCompositePrimaryKeyin interfaceCassandraPersistentProperty
-
isClusterKeyColumn
public boolean isClusterKeyColumn()Description copied from interface:CassandraPersistentPropertyWhether the property is a cluster key column.- Specified by:
isClusterKeyColumnin interfaceCassandraPersistentProperty
-
isPartitionKeyColumn
public boolean isPartitionKeyColumn()Description copied from interface:CassandraPersistentPropertyWhether the property is a partition key column.- Specified by:
isPartitionKeyColumnin interfaceCassandraPersistentProperty
-
isPrimaryKeyColumn
public boolean isPrimaryKeyColumn()Description copied from interface:CassandraPersistentPropertyWhether the property is a partition key column or a cluster key column- Specified by:
isPrimaryKeyColumnin interfaceCassandraPersistentProperty- See Also:
-
isStaticColumn
public boolean isStaticColumn()Description copied from interface:CassandraPersistentPropertyWhether the property maps to a static column.- Specified by:
isStaticColumnin interfaceCassandraPersistentProperty
-
hasExplicitColumnName
public boolean hasExplicitColumnName()Description copied from interface:CassandraPersistentPropertyReturn whether the property has an explicitly configured column name. Eg. viaColumn.value(),PrimaryKey.value()orPrimaryKeyColumn.name()- Specified by:
hasExplicitColumnNamein interfaceCassandraPersistentProperty- Returns:
- true if a configured column name is present and non empty.
-
setColumnName
public void setColumnName(com.datastax.oss.driver.api.core.CqlIdentifier columnName) Description copied from interface:CassandraPersistentPropertyIf this property is mapped with a single column, set the column name to the givenCqlIdentifier. If this property is not mapped by a single column, throwsIllegalStateException. If the given column name is null,IllegalArgumentExceptionis thrown.- Specified by:
setColumnNamein interfaceCassandraPersistentProperty- Parameters:
columnName- must not be null.
-
setNamingStrategy
Set theNamingStrategyto use.- Parameters:
namingStrategy- must not be null.- Since:
- 3.0
-
setForceQuote
public void setForceQuote(boolean forceQuote) Description copied from interface:CassandraPersistentPropertyWhether to force-quote the column names of this property.- Specified by:
setForceQuotein interfaceCassandraPersistentProperty- Parameters:
forceQuote- true to enforce quoting.- See Also:
-
CassandraPersistentProperty.getColumnName()CqlIdentifier.fromInternal(String)
-
getAssociation
- Specified by:
getAssociationin interfacePersistentProperty<CassandraPersistentProperty>- Overrides:
getAssociationin classAbstractPersistentProperty<CassandraPersistentProperty>
-
createAssociation
- Specified by:
createAssociationin classAbstractPersistentProperty<CassandraPersistentProperty>
-
isMapLike
public boolean isMapLike()Description copied from interface:CassandraPersistentPropertyReturns whether the property is aMap.- Specified by:
isMapLikein interfaceCassandraPersistentProperty- Returns:
- a boolean indicating whether this property type is a
Map.
-
findAnnotatedType
Description copied from interface:CassandraPersistentPropertyFind anAnnotatedTypebyannotationTypederived from the property type. Annotated type is looked up by introspecting property field/accessors. Collection/Map-like types are introspected for type annotations within type arguments.- Specified by:
findAnnotatedTypein interfaceCassandraPersistentProperty- Parameters:
annotationType- must not be null.- Returns:
- the annotated type or null.
-