Removed deprecations.
Removed deprecated API and usasage of deprecated API. Closes #1340
This commit is contained in:
@@ -33,6 +33,7 @@ import org.springframework.data.convert.CustomConversions;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.jdbc.core.mapping.JdbcValue;
|
||||
import org.springframework.data.jdbc.support.JdbcUtil;
|
||||
import org.springframework.data.mapping.InstanceCreatorMetadata;
|
||||
import org.springframework.data.mapping.Parameter;
|
||||
import org.springframework.data.mapping.PersistentPropertyAccessor;
|
||||
import org.springframework.data.mapping.PersistentPropertyPath;
|
||||
@@ -50,7 +51,7 @@ import org.springframework.data.relational.core.mapping.PersistentPropertyPathEx
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
|
||||
import org.springframework.data.relational.core.sql.IdentifierProcessing;
|
||||
import org.springframework.data.util.ClassTypeInformation;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -267,7 +268,7 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
|
||||
return jdbcValue;
|
||||
}
|
||||
|
||||
Object convertedValue = writeValue(value, ClassTypeInformation.from(columnType));
|
||||
Object convertedValue = writeValue(value, TypeInformation.of(columnType));
|
||||
|
||||
if (convertedValue == null || !convertedValue.getClass().isArray()) {
|
||||
|
||||
@@ -293,7 +294,7 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
|
||||
|
||||
if (canWriteAsJdbcValue(value)) {
|
||||
|
||||
Object converted = writeValue(value, ClassTypeInformation.from(JdbcValue.class));
|
||||
Object converted = writeValue(value, TypeInformation.of(JdbcValue.class));
|
||||
if (converted instanceof JdbcValue) {
|
||||
return (JdbcValue) converted;
|
||||
}
|
||||
@@ -414,11 +415,11 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
|
||||
private T populateProperties(T instance, @Nullable Object idValue) {
|
||||
|
||||
PersistentPropertyAccessor<T> propertyAccessor = getPropertyAccessor(entity, instance);
|
||||
PreferredConstructor<T, RelationalPersistentProperty> persistenceConstructor = entity.getPersistenceConstructor();
|
||||
InstanceCreatorMetadata<RelationalPersistentProperty> creatorMetadata = entity.getInstanceCreatorMetadata();
|
||||
|
||||
entity.doWithAll(property -> {
|
||||
|
||||
if (persistenceConstructor != null && persistenceConstructor.isConstructorParameter(property)) {
|
||||
if (creatorMetadata != null && creatorMetadata.isCreatorParameter(property)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -548,10 +549,10 @@ public class BasicJdbcConverter extends BasicRelationalConverter implements Jdbc
|
||||
|
||||
private T createInstanceInternal(@Nullable Object idValue) {
|
||||
|
||||
PreferredConstructor<T, RelationalPersistentProperty> persistenceConstructor = entity.getPersistenceConstructor();
|
||||
InstanceCreatorMetadata<RelationalPersistentProperty> creatorMetadata = entity.getInstanceCreatorMetadata();
|
||||
ParameterValueProvider<RelationalPersistentProperty> provider;
|
||||
|
||||
if (persistenceConstructor != null && persistenceConstructor.hasParameters()) {
|
||||
if (creatorMetadata != null && creatorMetadata.hasParameters()) {
|
||||
|
||||
SpELExpressionEvaluator expressionEvaluator = new DefaultSpELExpressionEvaluator(accessor, spELContext);
|
||||
provider = new SpELExpressionParameterValueProvider<>(expressionEvaluator, getConversionService(),
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.springframework.data.relational.core.query.CriteriaDefinition;
|
||||
import org.springframework.data.relational.core.query.CriteriaDefinition.Comparator;
|
||||
import org.springframework.data.relational.core.query.ValueFunction;
|
||||
import org.springframework.data.relational.core.sql.*;
|
||||
import org.springframework.data.util.ClassTypeInformation;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.data.util.Pair;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
|
||||
@@ -441,11 +441,11 @@ public class QueryMapper {
|
||||
|
||||
Object first = convertValue(pair.getFirst(), typeInformation.getActualType() != null //
|
||||
? typeInformation.getRequiredActualType()
|
||||
: ClassTypeInformation.OBJECT);
|
||||
: TypeInformation.OBJECT);
|
||||
|
||||
Object second = convertValue(pair.getSecond(), typeInformation.getActualType() != null //
|
||||
? typeInformation.getRequiredActualType()
|
||||
: ClassTypeInformation.OBJECT);
|
||||
: TypeInformation.OBJECT);
|
||||
|
||||
return Pair.of(first, second);
|
||||
}
|
||||
@@ -457,14 +457,14 @@ public class QueryMapper {
|
||||
for (Object o : (Iterable<?>) value) {
|
||||
|
||||
mapped.add(convertValue(o, typeInformation.getActualType() != null ? typeInformation.getRequiredActualType()
|
||||
: ClassTypeInformation.OBJECT));
|
||||
: TypeInformation.OBJECT));
|
||||
}
|
||||
|
||||
return mapped;
|
||||
}
|
||||
|
||||
if (value.getClass().isArray()
|
||||
&& (ClassTypeInformation.OBJECT.equals(typeInformation) || typeInformation.isCollectionLike())) {
|
||||
&& (TypeInformation.OBJECT.equals(typeInformation) || typeInformation.isCollectionLike())) {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -587,7 +587,7 @@ public class QueryMapper {
|
||||
|
||||
private Expression bindBoolean(Column column, MapSqlParameterSource parameterSource, boolean value) {
|
||||
|
||||
Object converted = converter.writeValue(value, ClassTypeInformation.OBJECT);
|
||||
Object converted = converter.writeValue(value, TypeInformation.OBJECT);
|
||||
return bind(converted, JDBCType.BIT, parameterSource, column.getName().getReference());
|
||||
}
|
||||
|
||||
@@ -678,7 +678,7 @@ public class QueryMapper {
|
||||
}
|
||||
|
||||
public TypeInformation<?> getTypeHint() {
|
||||
return ClassTypeInformation.OBJECT;
|
||||
return TypeInformation.OBJECT;
|
||||
}
|
||||
|
||||
public SQLType getSqlType() {
|
||||
@@ -808,7 +808,7 @@ public class QueryMapper {
|
||||
}
|
||||
|
||||
if (this.property.getType().isPrimitive()) {
|
||||
return ClassTypeInformation.from(ClassUtils.resolvePrimitiveIfNecessary(this.property.getType()));
|
||||
return TypeInformation.of(ClassUtils.resolvePrimitiveIfNecessary(this.property.getType()));
|
||||
}
|
||||
|
||||
if (this.property.getType().isArray()) {
|
||||
|
||||
@@ -45,7 +45,6 @@ import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* A query to be executed based on a repository method, it's annotated SQL query and the arguments provided to the
|
||||
@@ -211,7 +210,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery {
|
||||
|
||||
String resultSetExtractorRef = queryMethod.getResultSetExtractorRef();
|
||||
|
||||
if (!StringUtils.isEmpty(resultSetExtractorRef)) {
|
||||
if (!ObjectUtils.isEmpty(resultSetExtractorRef)) {
|
||||
|
||||
Assert.notNull(beanFactory, "When a ResultSetExtractorRef is specified the BeanFactory must not be null");
|
||||
|
||||
@@ -253,7 +252,7 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery {
|
||||
|
||||
String rowMapperRef = queryMethod.getRowMapperRef();
|
||||
|
||||
if (!StringUtils.isEmpty(rowMapperRef)) {
|
||||
if (!ObjectUtils.isEmpty(rowMapperRef)) {
|
||||
|
||||
Assert.notNull(beanFactory, "When a RowMapperRef is specified the BeanFactory must not be null");
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import org.springframework.data.jdbc.support.JdbcUtil;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
|
||||
import org.springframework.data.relational.core.sql.IdentifierProcessing;
|
||||
import org.springframework.data.util.ClassTypeInformation;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link BasicJdbcConverter}.
|
||||
@@ -147,7 +147,7 @@ public class BasicJdbcConverterUnitTests {
|
||||
|
||||
RelationalPersistentProperty property = persistentEntity.getRequiredPersistentProperty(propertyName);
|
||||
|
||||
Object converted = converter.writeValue(value, ClassTypeInformation.from(converter.getColumnType(property)));
|
||||
Object converted = converter.writeValue(value, TypeInformation.of(converter.getColumnType(property)));
|
||||
Object convertedBack = converter.readValue(converted, property.getTypeInformation());
|
||||
|
||||
softly.assertThat(convertedBack).describedAs(propertyName).isEqualTo(value);
|
||||
|
||||
@@ -20,13 +20,12 @@ import static org.mockito.Mockito.*;
|
||||
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
|
||||
import org.springframework.data.util.ClassTypeInformation;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
|
||||
/**
|
||||
* Unit tests for the handling of {@link AggregateReference}s in the
|
||||
@@ -59,7 +58,7 @@ public class BasicRelationalConverterAggregateReferenceUnitTests {
|
||||
|
||||
AggregateReference<Object, Integer> reference = AggregateReference.to(23);
|
||||
|
||||
Object writeValue = converter.writeValue(reference, ClassTypeInformation.from(converter.getColumnType(property)));
|
||||
Object writeValue = converter.writeValue(reference, TypeInformation.of(converter.getColumnType(property)));
|
||||
|
||||
Assertions.assertThat(writeValue).isEqualTo(23L);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.invocation.InvocationOnMock;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.annotation.PersistenceConstructor;
|
||||
import org.springframework.data.annotation.PersistenceCreator;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
|
||||
@@ -755,7 +755,7 @@ public class EntityRowMapperUnitTests {
|
||||
String two;
|
||||
final String three;
|
||||
|
||||
@PersistenceConstructor
|
||||
@PersistenceCreator
|
||||
MixedProperties(String one) {
|
||||
this.one = one;
|
||||
this.three = "unset";
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.core.type.StandardAnnotationMetadata;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
import org.springframework.data.repository.Repository;
|
||||
import org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource;
|
||||
@@ -40,13 +40,13 @@ import org.springframework.data.repository.config.RepositoryConfigurationSource;
|
||||
*/
|
||||
public class JdbcRepositoryConfigExtensionUnitTests {
|
||||
|
||||
StandardAnnotationMetadata metadata = new StandardAnnotationMetadata(Config.class, true);
|
||||
AnnotationMetadata metadata = AnnotationMetadata.introspect(Config.class);
|
||||
ResourceLoader loader = new PathMatchingResourcePatternResolver();
|
||||
Environment environment = new StandardEnvironment();
|
||||
BeanDefinitionRegistry registry = new DefaultListableBeanFactory();
|
||||
|
||||
RepositoryConfigurationSource configurationSource = new AnnotationRepositoryConfigurationSource(metadata,
|
||||
EnableJdbcRepositories.class, loader, environment, registry);
|
||||
EnableJdbcRepositories.class, loader, environment, registry, null);
|
||||
|
||||
@Test // DATAJPA-437
|
||||
public void isStrictMatchOnlyIfDomainTypeIsAnnotatedWithDocument() {
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.data.relational.repository.Lock;
|
||||
import org.springframework.data.repository.core.NamedQueries;
|
||||
import org.springframework.data.repository.core.RepositoryMetadata;
|
||||
import org.springframework.data.repository.core.support.PropertiesBasedNamedQueries;
|
||||
import org.springframework.data.util.ClassTypeInformation;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
|
||||
/**
|
||||
@@ -67,7 +67,7 @@ public class JdbcQueryMethodUnitTests {
|
||||
|
||||
metadata = mock(RepositoryMetadata.class);
|
||||
doReturn(String.class).when(metadata).getReturnedDomainClass(any(Method.class));
|
||||
doReturn(ClassTypeInformation.from(String.class)).when(metadata).getReturnType(any(Method.class));
|
||||
doReturn(TypeInformation.of(String.class)).when(metadata).getReturnType(any(Method.class));
|
||||
}
|
||||
|
||||
@Test // DATAJDBC-165
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.stream.Stream;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
@@ -42,7 +41,7 @@ import org.springframework.data.repository.core.NamedQueries;
|
||||
import org.springframework.data.repository.core.RepositoryMetadata;
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy;
|
||||
import org.springframework.data.repository.query.RepositoryQuery;
|
||||
import org.springframework.data.util.ClassTypeInformation;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
|
||||
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
|
||||
@@ -77,7 +76,7 @@ class JdbcQueryLookupStrategyUnitTests {
|
||||
this.metadata = mock(RepositoryMetadata.class);
|
||||
|
||||
doReturn(NumberFormat.class).when(metadata).getReturnedDomainClass(any(Method.class));
|
||||
doReturn(ClassTypeInformation.from(NumberFormat.class)).when(metadata).getReturnType(any(Method.class));
|
||||
doReturn(TypeInformation.of(NumberFormat.class)).when(metadata).getReturnType(any(Method.class));
|
||||
}
|
||||
|
||||
@Test // DATAJDBC-166
|
||||
|
||||
Reference in New Issue
Block a user