From 291710b88fea5511f7fe30fd23d18db0e99674f3 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Mon, 23 Mar 2020 16:15:48 +0100 Subject: [PATCH] DATACASS-470 - Deprecate getType() and getCreate(Table/UserType/Index)SpecificationFor on mapping metadata types. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .../core/mapping/CassandraMappingContext.java | 16 ++++++++++++++++ .../core/mapping/CassandraPersistentEntity.java | 4 ++++ .../mapping/CassandraPersistentProperty.java | 2 ++ 3 files changed, 22 insertions(+) diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/mapping/CassandraMappingContext.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/mapping/CassandraMappingContext.java index d0cb0cd31..7b0c34469 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/mapping/CassandraMappingContext.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/mapping/CassandraMappingContext.java @@ -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 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); } diff --git a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/mapping/CassandraPersistentEntity.java b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/mapping/CassandraPersistentEntity.java index cfe1f6218..cbb09c0cf 100644 --- a/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/mapping/CassandraPersistentEntity.java +++ b/spring-data-cassandra/src/main/java/org/springframework/data/cassandra/core/mapping/CassandraPersistentEntity.java @@ -66,8 +66,10 @@ public interface CassandraPersistentEntity extends PersistentEntity extends PersistentEntity