DATACASS-470 - Deprecate getType() and getCreate(Table/UserType/Index)SpecificationFor on mapping metadata types.

In preparation for moving type resolution from the MappingContext onto the converter level, we're deprecating the following method:

* CassandraPersistentEntity.getUserType()
* CassandraPersistentEntity.getTupleType()
* CassandraPersistentProperty.getDataType(…)
* CassandraMappingContext.getDataType(…)
* CassandraMappingContext.getCreateTableSpecificationFor(…)
* CassandraMappingContext.getCreateIndexSpecificationsFor(…)
* CassandraMappingContext.getCreateUserTypeSpecificationFor(…)

These methods will be removed and replacements will be introduced with the next major release version 3.0.
This commit is contained in:
Mark Paluch
2020-03-23 16:15:48 +01:00
parent 4b00f85168
commit 291710b88f
3 changed files with 22 additions and 0 deletions

View File

@@ -448,7 +448,9 @@ public class CassandraMappingContext
* @param entity must not be {@literal null}.
* @return
* @since 2.2
* @deprecated will be removed in version 3.0 in favor of {@code SchemaFactory}.
*/
@Deprecated
public CreateTableSpecification getCreateTableSpecificationFor(CqlIdentifier tableName,
CassandraPersistentEntity<?> entity) {
@@ -496,7 +498,9 @@ public class CassandraMappingContext
* @param entity must not be {@literal null}.
* @return
* @since 2.0
* @deprecated will be removed in version 3.0 in favor of {@code SchemaFactory}.
*/
@Deprecated
public List<CreateIndexSpecification> getCreateIndexSpecificationsFor(CassandraPersistentEntity<?> entity) {
Assert.notNull(entity, "CassandraPersistentEntity must not be null");
@@ -520,7 +524,9 @@ public class CassandraMappingContext
* Returns a {@link CreateUserTypeSpecification} for the given entity, including all mapping information.
*
* @param entity must not be {@literal null}.
* @deprecated will be removed in version 3.0 in favor of {@code SchemaFactory}.
*/
@Deprecated
public CreateUserTypeSpecification getCreateUserTypeSpecificationFor(CassandraPersistentEntity<?> entity) {
Assert.notNull(entity, "CassandraPersistentEntity must not be null");
@@ -549,11 +555,19 @@ public class CassandraMappingContext
* @see org.springframework.data.convert.CustomConversions
* @see CassandraSimpleTypeHolder
* @since 1.5
* @deprecated will be removed in version 3.0 in favor of {@code ColumnTypeResolver}.
*/
@Deprecated
public DataType getDataType(Class<?> type) {
return doGetDataType(type, this.customConversions.getCustomWriteTarget(type).orElse(type));
}
/**
* @param persistentEntity
* @return
* @deprecated will be removed in version 3.0 in favor of {@code ColumnTypeResolver}.
*/
@Deprecated
public TupleType getTupleType(CassandraPersistentEntity<?> persistentEntity) {
Assert.notNull(persistentEntity, "CassandraPersistentEntity must not be null");
@@ -571,7 +585,9 @@ public class CassandraMappingContext
* @see org.springframework.data.convert.CustomConversions
* @see CassandraSimpleTypeHolder
* @since 1.5
* @deprecated will be removed in version 3.0 in favor of {@code ColumnTypeResolver}.
*/
@Deprecated
public DataType getDataType(CassandraPersistentProperty property) {
return getDataTypeWithUserTypeFactory(property, DataTypeProvider.EntityUserType);
}

View File

@@ -66,8 +66,10 @@ public interface CassandraPersistentEntity<T> extends PersistentEntity<T, Cassan
* @return the {@link TupleType} matching the data types from {@link BasicCassandraPersistentTupleProperty mapped
* tuple elements}.
* @since 2.1
* @deprecated will be removed in version 3.0 in favor of {@code ColumnTypeResolver}.
*/
@Nullable
@Deprecated
TupleType getTupleType();
/**
@@ -81,8 +83,10 @@ public interface CassandraPersistentEntity<T> extends PersistentEntity<T, Cassan
* @return the CQL {@link UserType} if the type is a mapped user defined type, otherwise {@literal null}.
* @since 1.5
* @see UserDefinedType
* @deprecated will be removed in version 3.0 in favor of {@code ColumnTypeResolver}.
*/
@Nullable
@Deprecated
UserType getUserType();
}

View File

@@ -77,7 +77,9 @@ public interface CassandraPersistentProperty
* @return the Cassandra {@link DataType}
* @throws InvalidDataAccessApiUsageException if the {@link DataType} cannot be resolved
* @see CassandraType
* @deprecated will be removed in version 3.0 in favor of {@code ColumnTypeResolver}.
*/
@Deprecated
DataType getDataType();
/**