@@ -72,7 +72,7 @@ public class ApplicationModule {
72
72
private final boolean useFullyQualifiedModuleNames ;
73
73
74
74
private final Supplier <Classes > springBeans ;
75
- private final Supplier <Classes > entities ;
75
+ private final Supplier <Classes > aggregateRoots ;
76
76
private final Supplier <List <JavaClass >> valueTypes ;
77
77
private final Supplier <List <EventType >> publishedEvents ;
78
78
@@ -90,7 +90,7 @@ public class ApplicationModule {
90
90
this .useFullyQualifiedModuleNames = useFullyQualifiedModuleNames ;
91
91
92
92
this .springBeans = Suppliers .memoize (() -> filterSpringBeans (basePackage ));
93
- this .entities = Suppliers .memoize (() -> findEntities (basePackage ));
93
+ this .aggregateRoots = Suppliers .memoize (() -> findAggregateRoots (basePackage ));
94
94
this .valueTypes = Suppliers
95
95
.memoize (() -> findArchitecturallyEvidentType (ArchitecturallyEvidentType ::isValueObject ));
96
96
this .publishedEvents = Suppliers .memoize (() -> findPublishedEvents ());
@@ -195,10 +195,7 @@ public List<JavaClass> getValueTypes() {
195
195
*/
196
196
public List <JavaClass > getAggregateRoots () {
197
197
198
- return entities .get ().stream () //
199
- .map (it -> ArchitecturallyEvidentType .of (it , getSpringBeansInternal ())) //
200
- .filter (ArchitecturallyEvidentType ::isAggregateRoot ) //
201
- .map (ArchitecturallyEvidentType ::getType ) //
198
+ return aggregateRoots .get ().stream () //
202
199
.flatMap (this ::resolveModuleSuperTypes ) //
203
200
.distinct () //
204
201
.toList ();
@@ -433,7 +430,7 @@ public boolean equals(Object obj) {
433
430
}
434
431
435
432
return Objects .equals (this .basePackage , that .basePackage ) //
436
- && Objects .equals (this .entities , that .entities ) //
433
+ && Objects .equals (this .aggregateRoots , that .aggregateRoots ) //
437
434
&& Objects .equals (this .information , that .information ) //
438
435
&& Objects .equals (this .namedInterfaces , that .namedInterfaces ) //
439
436
&& Objects .equals (this .publishedEvents , that .publishedEvents ) //
@@ -448,7 +445,7 @@ public boolean equals(Object obj) {
448
445
*/
449
446
@ Override
450
447
public int hashCode () {
451
- return Objects .hash (basePackage , entities , information , namedInterfaces , publishedEvents , springBeans ,
448
+ return Objects .hash (basePackage , aggregateRoots , information , namedInterfaces , publishedEvents , springBeans ,
452
449
useFullyQualifiedModuleNames , valueTypes );
453
450
}
454
451
@@ -532,12 +529,13 @@ private boolean isDependencyToOtherModule(JavaClass dependency, ApplicationModul
532
529
return modules .contains (dependency ) && !contains (dependency );
533
530
}
534
531
535
- private Classes findEntities (JavaPackage source ) {
532
+ private Classes findAggregateRoots (JavaPackage source ) {
536
533
537
534
return source .stream () //
538
535
.map (it -> ArchitecturallyEvidentType .of (it , getSpringBeansInternal ()))
539
- .filter (ArchitecturallyEvidentType ::isEntity ) //
540
- .map (ArchitecturallyEvidentType ::getType ).collect (Classes .toClasses ());
536
+ .filter (ArchitecturallyEvidentType ::isAggregateRoot ) //
537
+ .map (ArchitecturallyEvidentType ::getType ) //
538
+ .collect (Classes .toClasses ());
541
539
}
542
540
543
541
private static Classes filterSpringBeans (JavaPackage source ) {
0 commit comments