3737import org .seasar .doma .jdbc .entity .Property ;
3838import org .seasar .doma .jdbc .query .Query ;
3939
40- public class LinkableEntityPoolProvider extends AbstractObjectProvider <LinkableEntityPool > {
40+ public class AggregateEntityPoolProvider extends AbstractObjectProvider <AggregateEntityPool > {
4141
4242 private final EntityType <?> entityType ;
4343 private final Query query ;
44- private final Set <EntityCacheKey > rootEntityKeys ;
45- private final Map <EntityCacheKey , Object > entityCache ;
44+ private final Set <AggregateEntityCacheKey > rootEntityKeys ;
45+ private final Map <AggregateEntityCacheKey , Object > entityCache ;
4646 private Map <Integer , MappingSupport .PropType > indexMap ;
4747 private final MappingSupport mappingSupport ;
4848 private final FetchSupport fetchSupport ;
4949 private final AggregateStrategyType aggregateStrategyType ;
5050 private final Map <String , AssociationLinkerType <?, ?>> associationLinkerTypeMap ;
5151
52- public LinkableEntityPoolProvider (
52+ public AggregateEntityPoolProvider (
5353 EntityType <?> entityType ,
5454 AggregateStrategyType aggregateStrategyType ,
5555 Query query ,
5656 boolean resultMappingEnsured ,
57- Set <EntityCacheKey > rootEntityKeys ,
58- Map <EntityCacheKey , Object > entityCache ) {
57+ Set <AggregateEntityCacheKey > rootEntityKeys ,
58+ Map <AggregateEntityCacheKey , Object > entityCache ) {
5959 assertNotNull (entityType , aggregateStrategyType , query , rootEntityKeys , entityCache );
6060 this .entityType = entityType ;
6161 this .query = query ;
@@ -76,9 +76,9 @@ public LinkableEntityPoolProvider(
7676 }
7777
7878 @ Override
79- public LinkableEntityPool get (ResultSet resultSet ) throws SQLException {
79+ public AggregateEntityPool get (ResultSet resultSet ) throws SQLException {
8080 List <MappingSupport .Prop > props = createProps (resultSet );
81- Map <PathKey , List <MappingSupport .Prop >> propGroup = groupPropsByPathKey (props );
81+ Map <AggregatePathKey , List <MappingSupport .Prop >> propGroup = groupPropsByPathKey (props );
8282 return createEntityPool (propGroup );
8383 }
8484
@@ -143,29 +143,31 @@ private void collectColumnNames(
143143 }
144144 }
145145
146- private Map <PathKey , List <MappingSupport .Prop >> groupPropsByPathKey (
146+ private Map <AggregatePathKey , List <MappingSupport .Prop >> groupPropsByPathKey (
147147 List <MappingSupport .Prop > props ) {
148148 return props .stream ()
149- .collect (Collectors .groupingBy (it -> new PathKey (it .propertyPath (), it .entityType ())));
149+ .collect (
150+ Collectors .groupingBy (it -> new AggregatePathKey (it .propertyPath (), it .entityType ())));
150151 }
151152
152153 /**
153- * Creates and populates a {@link LinkableEntityPool } based on the provided group of properties
154- * organized by their {@link PathKey }.
154+ * Creates and populates a {@link AggregateEntityPool } based on the provided group of properties
155+ * organized by their {@link AggregatePathKey }.
155156 */
156- private LinkableEntityPool createEntityPool (Map <PathKey , List <MappingSupport .Prop >> propGroup ) {
157- LinkableEntityPool entityPool = new LinkableEntityPool ();
157+ private AggregateEntityPool createEntityPool (
158+ Map <AggregatePathKey , List <MappingSupport .Prop >> propGroup ) {
159+ AggregateEntityPool entityPool = new AggregateEntityPool ();
158160
159- for (Map .Entry <PathKey , List <MappingSupport .Prop >> entry : propGroup .entrySet ()) {
160- PathKey pathKey = entry .getKey ();
161+ for (Map .Entry <AggregatePathKey , List <MappingSupport .Prop >> entry : propGroup .entrySet ()) {
162+ AggregatePathKey pathKey = entry .getKey ();
161163 List <MappingSupport .Prop > props = entry .getValue ();
162164 if (props .stream ().allMatch (p -> p .rawValue () == null )) {
163165 continue ;
164166 }
165- LinkableEntityKey entityKey = createLinkableEntityKey (pathKey , props );
166- EntityCacheKey cacheKey = EntityCacheKey .of (entityKey );
167+ AggregateEntityKey entityKey = createEntityKey (pathKey , props );
168+ AggregateEntityCacheKey cacheKey = AggregateEntityCacheKey .of (entityKey );
167169 Object entity = entityCache .computeIfAbsent (cacheKey , k -> createEntity (k , props ));
168- entityPool .add (new LinkableEntityPoolEntry (entityKey , entity ));
170+ entityPool .add (new AggregateEntityPoolEntry (entityKey , entity ));
169171 if (pathKey .isRoot ()) {
170172 rootEntityKeys .add (cacheKey );
171173 }
@@ -174,20 +176,21 @@ private LinkableEntityPool createEntityPool(Map<PathKey, List<MappingSupport.Pro
174176 return entityPool ;
175177 }
176178
177- private static LinkableEntityKey createLinkableEntityKey (
178- PathKey pathKey , List <MappingSupport .Prop > props ) {
179- LinkableEntityKey entityKey ;
179+ private static AggregateEntityKey createEntityKey (
180+ AggregatePathKey pathKey , List <MappingSupport .Prop > props ) {
181+ AggregateEntityKey entityKey ;
180182 if (pathKey .entityType ().getIdPropertyTypes ().isEmpty ()) {
181- entityKey = new LinkableEntityKey (pathKey , Collections .singletonList (new Object ()));
183+ entityKey = new AggregateEntityKey (pathKey , Collections .singletonList (new Object ()));
182184 } else {
183185 List <?> items =
184186 props .stream ().filter (MappingSupport .Prop ::isId ).map (it -> it .wrapper ().get ()).toList ();
185- entityKey = new LinkableEntityKey (pathKey , items );
187+ entityKey = new AggregateEntityKey (pathKey , items );
186188 }
187189 return entityKey ;
188190 }
189191
190- private static Object createEntity (EntityCacheKey cacheKey , List <MappingSupport .Prop > props ) {
192+ private static Object createEntity (
193+ AggregateEntityCacheKey cacheKey , List <MappingSupport .Prop > props ) {
191194 @ SuppressWarnings ("unchecked" )
192195 EntityType <Object > entityType = (EntityType <Object >) cacheKey .entityType ();
193196 Map <String , Property <Object , ?>> states =
0 commit comments