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 anAnnotatedType
byannotationType
derived from the property type.com.datastax.oss.driver.api.core.CqlIdentifier
The 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.boolean
Return whether the property has an explicitly configured column name.boolean
Whether the property is a cluster key column.boolean
Whether the property is a composite primary key.boolean
Returns whether the property is aMap
.boolean
Whether the property is a partition key column.boolean
Whether the property is a partition key column or a cluster key columnboolean
Whether the property maps to a static column.void
setApplicationContext
(ApplicationContext context) void
setColumnName
(com.datastax.oss.driver.api.core.CqlIdentifier columnName) If this property is mapped with a single column, set the column name to the givenCqlIdentifier
.void
setForceQuote
(boolean forceQuote) Whether to force-quote the column names of this property.void
setNamingStrategy
(NamingStrategy namingStrategy) Set theNamingStrategy
to use.Methods inherited from class org.springframework.data.mapping.model.AnnotationBasedPersistentProperty
findAnnotation, findPropertyOrOwnerAnnotation, getAssociationTargetTypeInformation, getSpelExpression, isAnnotationPresent, isAssociation, isIdProperty, isTransient, isVersionProperty, isWritable, toString, usePropertyAccess
Methods 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, isMap, isReadable
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.data.cassandra.core.mapping.CassandraPersistentProperty
getRequiredColumnName, getRequiredOrdinal, hasOrdinal, isEmbedded, setColumnName
Methods 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, isReadable, isTransient, isVersionProperty, isWritable, usePropertyAccess
-
Constructor Details
-
BasicCassandraPersistentProperty
public BasicCassandraPersistentProperty(Property property, CassandraPersistentEntity<?> owner, SimpleTypeHolder simpleTypeHolder) Create a newBasicCassandraPersistentProperty
.- Parameters:
property
- the actualProperty
in the domain entity corresponding to this persistent entity.owner
- the containing object orCassandraPersistentEntity
of this persistent property.simpleTypeHolder
- mapping of Java [simple|wrapper] types to Cassandra data types.
-
-
Method Details
-
setApplicationContext
- Specified by:
setApplicationContext
in interfaceApplicationContextAware
-
getOwner
- Specified by:
getOwner
in interfacePersistentProperty<CassandraPersistentProperty>
- Overrides:
getOwner
in classAbstractPersistentProperty<CassandraPersistentProperty>
-
getColumnName
public com.datastax.oss.driver.api.core.CqlIdentifier getColumnName()Description copied from interface:CassandraPersistentProperty
The name of the single column to which the property is persisted.- Specified by:
getColumnName
in interfaceCassandraPersistentProperty
-
getOrdinal
Description copied from interface:CassandraPersistentProperty
The name of the element ordinal to which the property is persisted when the owning type is a mapped tuple.- Specified by:
getOrdinal
in interfaceCassandraPersistentProperty
-
getPrimaryKeyOrdering
Description copied from interface:CassandraPersistentProperty
The ordering (ascending or descending) for the column. Valid only for primary key columns; returns null for non-primary key columns.- Specified by:
getPrimaryKeyOrdering
in interfaceCassandraPersistentProperty
-
isCompositePrimaryKey
public boolean isCompositePrimaryKey()Description copied from interface:CassandraPersistentProperty
Whether the property is a composite primary key.- Specified by:
isCompositePrimaryKey
in interfaceCassandraPersistentProperty
-
isClusterKeyColumn
public boolean isClusterKeyColumn()Description copied from interface:CassandraPersistentProperty
Whether the property is a cluster key column.- Specified by:
isClusterKeyColumn
in interfaceCassandraPersistentProperty
-
isPartitionKeyColumn
public boolean isPartitionKeyColumn()Description copied from interface:CassandraPersistentProperty
Whether the property is a partition key column.- Specified by:
isPartitionKeyColumn
in interfaceCassandraPersistentProperty
-
isPrimaryKeyColumn
public boolean isPrimaryKeyColumn()Description copied from interface:CassandraPersistentProperty
Whether the property is a partition key column or a cluster key column- Specified by:
isPrimaryKeyColumn
in interfaceCassandraPersistentProperty
- See Also:
-
isStaticColumn
public boolean isStaticColumn()Description copied from interface:CassandraPersistentProperty
Whether the property maps to a static column.- Specified by:
isStaticColumn
in interfaceCassandraPersistentProperty
-
hasExplicitColumnName
public boolean hasExplicitColumnName()Description copied from interface:CassandraPersistentProperty
Return whether the property has an explicitly configured column name. Eg. viaColumn.value()
,PrimaryKey.value()
orPrimaryKeyColumn.name()
- Specified by:
hasExplicitColumnName
in 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:CassandraPersistentProperty
If 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,IllegalArgumentException
is thrown.- Specified by:
setColumnName
in interfaceCassandraPersistentProperty
- Parameters:
columnName
- must not be null.
-
setNamingStrategy
Set theNamingStrategy
to use.- Parameters:
namingStrategy
- must not be null.- Since:
- 3.0
-
setForceQuote
public void setForceQuote(boolean forceQuote) Description copied from interface:CassandraPersistentProperty
Whether to force-quote the column names of this property.- Specified by:
setForceQuote
in interfaceCassandraPersistentProperty
- Parameters:
forceQuote
- true to enforce quoting.- See Also:
-
CassandraPersistentProperty.getColumnName()
CqlIdentifier.fromInternal(String)
-
getAssociation
- Specified by:
getAssociation
in interfacePersistentProperty<CassandraPersistentProperty>
- Overrides:
getAssociation
in classAbstractPersistentProperty<CassandraPersistentProperty>
-
createAssociation
- Specified by:
createAssociation
in classAbstractPersistentProperty<CassandraPersistentProperty>
-
isMapLike
public boolean isMapLike()Description copied from interface:CassandraPersistentProperty
Returns whether the property is aMap
.- Specified by:
isMapLike
in interfaceCassandraPersistentProperty
- Returns:
- a boolean indicating whether this property type is a
Map
.
-
findAnnotatedType
Description copied from interface:CassandraPersistentProperty
Find anAnnotatedType
byannotationType
derived 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:
findAnnotatedType
in interfaceCassandraPersistentProperty
- Parameters:
annotationType
- must not be null.- Returns:
- the annotated type or null.
-