Adapt to API consolidation in Spring Data Commons' PersistentProperty.
Closes: #2254 Original Pull Request: #2255 Related to: spring-projects/spring-data-commons#2408
This commit is contained in:
committed by
Christoph Strobl
parent
8d6634430f
commit
400aa0e042
@@ -39,7 +39,7 @@ import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* {@link JpaPersistentProperty} implementation usind a JPA {@link Metamodel}.
|
||||
* {@link JpaPersistentProperty} implementation using a JPA {@link Metamodel}.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
@@ -130,10 +130,19 @@ class JpaPersistentPropertyImpl extends AnnotationBasedPersistentProperty<JpaPer
|
||||
*/
|
||||
@Override
|
||||
public Iterable<? extends TypeInformation<?>> getPersistentEntityTypes() {
|
||||
return getPersistentEntityTypeInformation();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.model.AbstractPersistentProperty#getPersistentEntityTypeInformation()
|
||||
*/
|
||||
@Override
|
||||
public Iterable<? extends TypeInformation<?>> getPersistentEntityTypeInformation() {
|
||||
|
||||
return associationTargetType != null //
|
||||
? Collections.singleton(associationTargetType) //
|
||||
: super.getPersistentEntityTypes();
|
||||
: super.getPersistentEntityTypeInformation();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -219,22 +228,22 @@ class JpaPersistentPropertyImpl extends AnnotationBasedPersistentProperty<JpaPer
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.mapping.model.AnnotationBasedPersistentProperty#getAssociationTargetType()
|
||||
* @see org.springframework.data.mapping.model.AnnotationBasedPersistentProperty#getAssociationTargetTypeInformation()
|
||||
*/
|
||||
@Override
|
||||
public Class<?> getAssociationTargetType() {
|
||||
public TypeInformation<?> getAssociationTargetTypeInformation() {
|
||||
|
||||
if (!isAssociation()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (associationTargetType != null) {
|
||||
return associationTargetType.getType();
|
||||
return associationTargetType;
|
||||
}
|
||||
|
||||
Class<?> targetType = super.getAssociationTargetType();
|
||||
TypeInformation<?> targetType = super.getAssociationTargetTypeInformation();
|
||||
|
||||
return targetType != null ? targetType : getActualType();
|
||||
return targetType != null ? targetType : getActualTypeInformation();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -144,7 +144,7 @@ public class JpaPersistentPropertyImplUnitTests {
|
||||
assertThat(property.getType()).isEqualTo(Api.class);
|
||||
assertThat(property.getActualType()).isEqualTo(Implementation.class);
|
||||
|
||||
Iterable<? extends TypeInformation<?>> entityType = property.getPersistentEntityTypes();
|
||||
Iterable<? extends TypeInformation<?>> entityType = property.getPersistentEntityTypeInformation();
|
||||
assertThat(entityType.iterator().hasNext()).isTrue();
|
||||
assertThat(entityType.iterator().next())
|
||||
.isEqualTo(ClassTypeInformation.from(Implementation.class));
|
||||
|
||||
Reference in New Issue
Block a user