File tree Expand file tree Collapse file tree 3 files changed +8
-30
lines changed
main/java/org/springframework/data/mapping
test/java/org/springframework/data/mapping/context Expand file tree Collapse file tree 3 files changed +8
-30
lines changed Original file line number Diff line number Diff line change 31
31
* @author Mark Paluch
32
32
* @author Christoph Strobl
33
33
*/
34
- public interface PersistentEntity <T , P extends PersistentProperty <P >> {
34
+ public interface PersistentEntity <T , P extends PersistentProperty <P >> extends Iterable < P > {
35
35
36
36
/**
37
37
* The entity name including any package prefix.
@@ -224,14 +224,6 @@ default P getPersistentProperty(Class<? extends Annotation> annotationType) {
224
224
225
225
void doWithProperties (SimplePropertyHandler handler );
226
226
227
- /**
228
- * Get {@link Iterable}
229
- *
230
- * @return
231
- * @since 2.0
232
- */
233
- Iterable <P > getPersistentProperties ();
234
-
235
227
/**
236
228
* Applies the given {@link AssociationHandler} to all {@link Association} contained in this {@link PersistentEntity}.
237
229
*
@@ -241,8 +233,6 @@ default P getPersistentProperty(Class<? extends Annotation> annotationType) {
241
233
242
234
void doWithAssociations (SimpleAssociationHandler handler );
243
235
244
- Iterable <Association <P >> getAssociations ();
245
-
246
236
/**
247
237
* Looks up the annotation of the given type on the {@link PersistentEntity}.
248
238
*
Original file line number Diff line number Diff line change 25
25
import java .util .Comparator ;
26
26
import java .util .HashMap ;
27
27
import java .util .HashSet ;
28
+ import java .util .Iterator ;
28
29
import java .util .List ;
29
30
import java .util .Map ;
30
31
import java .util .Optional ;
@@ -353,15 +354,6 @@ public void doWithProperties(SimplePropertyHandler handler) {
353
354
}
354
355
}
355
356
356
- /*
357
- * (non-Javadoc)
358
- * @see org.springframework.data.mapping.PersistentEntity#getPersistentProperties()
359
- */
360
- @ Override
361
- public List <P > getPersistentProperties () {
362
- return Collections .unmodifiableList (persistentPropertiesCache );
363
- }
364
-
365
357
/*
366
358
* (non-Javadoc)
367
359
* @see org.springframework.data.mapping.PersistentEntity#doWithAssociations(org.springframework.data.mapping.AssociationHandler)
@@ -388,15 +380,6 @@ public void doWithAssociations(SimpleAssociationHandler handler) {
388
380
}
389
381
}
390
382
391
- /*
392
- * (non-Javadoc)
393
- * @see org.springframework.data.mapping.PersistentEntity#getAssociations()
394
- */
395
- @ Override
396
- public Set <Association <P >> getAssociations () {
397
- return Collections .unmodifiableSet (associations );
398
- }
399
-
400
383
/*
401
384
* (non-Javadoc)
402
385
* @see org.springframework.data.mapping.PersistentEntity#findAnnotation(java.lang.Class)
@@ -471,6 +454,11 @@ public IdentifierAccessor getIdentifierAccessor(Object bean) {
471
454
return hasIdProperty () ? new IdPropertyIdentifierAccessor (this , bean ) : new AbsentIdentifierAccessor (bean );
472
455
}
473
456
457
+ @ Override
458
+ public Iterator <P > iterator () {
459
+ return Collections .unmodifiableList (properties ).iterator ();
460
+ }
461
+
474
462
/**
475
463
* Calculates the {@link Alias} to be used for the given type.
476
464
*
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ public void returnsEntityForComponentType() {
155
155
156
156
assertThat (entity .getPersistentProperty ("persons" ))
157
157
.satisfies (it -> assertThat (mappingContext .getPersistentEntity (it ))
158
- .satisfies (inner -> assertThat (inner .getType ()).isEqualTo (Person .class )));
158
+ .satisfies (inner -> assertThat ((( PersistentEntity ) inner ) .getType ()).isEqualTo (Person .class )));
159
159
}
160
160
161
161
@ Test // DATACMNS-380
You can’t perform that action at this time.
0 commit comments