Remove references to ClassTypeInformation from TypeInformation.

Closes #2703
This commit is contained in:
Mark Paluch
2022-10-06 16:20:22 +02:00
parent 1ff6e39ec2
commit b55f098b43
9 changed files with 43 additions and 89 deletions

View File

@@ -22,7 +22,6 @@ import org.springframework.data.mapping.Alias;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
@@ -38,7 +37,7 @@ import org.springframework.util.Assert;
*/
public class MappingContextTypeInformationMapper implements TypeInformationMapper {
private final Map<ClassTypeInformation<?>, Alias> typeMap;
private final Map<TypeInformation<?>, Alias> typeMap;
private final MappingContext<? extends PersistentEntity<?, ?>, ?> mappingContext;
/**
@@ -79,7 +78,7 @@ public class MappingContextTypeInformationMapper implements TypeInformationMappe
* @param key must not be {@literal null}.
* @param alias can be {@literal null}.
*/
private Alias verify(ClassTypeInformation<?> key, Alias alias) {
private Alias verify(TypeInformation<?> key, Alias alias) {
// Reject second alias for same type
@@ -113,7 +112,7 @@ public class MappingContextTypeInformationMapper implements TypeInformationMappe
@Override
public TypeInformation<?> resolveTypeFrom(Alias alias) {
for (Map.Entry<ClassTypeInformation<?>, Alias> entry : typeMap.entrySet()) {
for (Map.Entry<TypeInformation<?>, Alias> entry : typeMap.entrySet()) {
if (entry.getValue().hasSamePresentValueAs(alias)) {
return entry.getKey();
}

View File

@@ -16,7 +16,6 @@
package org.springframework.data.convert;
import org.springframework.data.mapping.PersistentProperty;
import org.springframework.data.util.ClassTypeInformation;
import org.springframework.data.util.TypeInformation;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
@@ -65,7 +64,7 @@ public interface ValueConversionContext<P extends PersistentProperty<P>> {
* @return can be {@literal null}.
* @throws IllegalStateException if value cannot be written as an instance of {@link Class type}.
* @see #write(Object, TypeInformation)
* @see ClassTypeInformation
* @see TypeInformation
*/
@Nullable
default <T> T write(@Nullable Object value, @NonNull Class<T> target) {
@@ -115,7 +114,7 @@ public interface ValueConversionContext<P extends PersistentProperty<P>> {
* @return can be {@literal null}.
* @throws IllegalStateException if value cannot be read as an instance of {@link Class type}.
* @see #read(Object, TypeInformation)
* @see ClassTypeInformation
* @see TypeInformation
*/
@Nullable
default <T> T read(@Nullable Object value, @NonNull Class<T> target) {