Skip to content

Commit 400aa0e

Browse files
odrotbohmchristophstrobl
authored andcommitted
Adapt to API consolidation in Spring Data Commons' PersistentProperty.
Closes: #2254 Original Pull Request: #2255 Related to: spring-projects/spring-data-commons#2408
1 parent 8d66344 commit 400aa0e

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/main/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImpl.java

+16-7
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
import org.springframework.util.Assert;
4040

4141
/**
42-
* {@link JpaPersistentProperty} implementation usind a JPA {@link Metamodel}.
42+
* {@link JpaPersistentProperty} implementation using a JPA {@link Metamodel}.
4343
*
4444
* @author Oliver Gierke
4545
* @author Thomas Darimont
@@ -130,10 +130,19 @@ public Class<?> getActualType() {
130130
*/
131131
@Override
132132
public Iterable<? extends TypeInformation<?>> getPersistentEntityTypes() {
133+
return getPersistentEntityTypeInformation();
134+
}
135+
136+
/*
137+
* (non-Javadoc)
138+
* @see org.springframework.data.mapping.model.AbstractPersistentProperty#getPersistentEntityTypeInformation()
139+
*/
140+
@Override
141+
public Iterable<? extends TypeInformation<?>> getPersistentEntityTypeInformation() {
133142

134143
return associationTargetType != null //
135144
? Collections.singleton(associationTargetType) //
136-
: super.getPersistentEntityTypes();
145+
: super.getPersistentEntityTypeInformation();
137146
}
138147

139148
/*
@@ -219,22 +228,22 @@ public boolean isEmbeddable() {
219228

220229
/*
221230
* (non-Javadoc)
222-
* @see org.springframework.data.mapping.model.AnnotationBasedPersistentProperty#getAssociationTargetType()
231+
* @see org.springframework.data.mapping.model.AnnotationBasedPersistentProperty#getAssociationTargetTypeInformation()
223232
*/
224233
@Override
225-
public Class<?> getAssociationTargetType() {
234+
public TypeInformation<?> getAssociationTargetTypeInformation() {
226235

227236
if (!isAssociation()) {
228237
return null;
229238
}
230239

231240
if (associationTargetType != null) {
232-
return associationTargetType.getType();
241+
return associationTargetType;
233242
}
234243

235-
Class<?> targetType = super.getAssociationTargetType();
244+
TypeInformation<?> targetType = super.getAssociationTargetTypeInformation();
236245

237-
return targetType != null ? targetType : getActualType();
246+
return targetType != null ? targetType : getActualTypeInformation();
238247
}
239248

240249
/**

src/test/java/org/springframework/data/jpa/mapping/JpaPersistentPropertyImplUnitTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void considersTargetEntityTypeForPropertyType() {
144144
assertThat(property.getType()).isEqualTo(Api.class);
145145
assertThat(property.getActualType()).isEqualTo(Implementation.class);
146146

147-
Iterable<? extends TypeInformation<?>> entityType = property.getPersistentEntityTypes();
147+
Iterable<? extends TypeInformation<?>> entityType = property.getPersistentEntityTypeInformation();
148148
assertThat(entityType.iterator().hasNext()).isTrue();
149149
assertThat(entityType.iterator().next())
150150
.isEqualTo(ClassTypeInformation.from(Implementation.class));

0 commit comments

Comments
 (0)