4343 * caching to avoid duplicate instantiation, and handles linking of associated entities. This
4444 * provider is configured with essential details such as the entity type, query, aggregation
4545 * strategy, and mapping and fetching mechanisms.
46- *
47- * <p>It ensures efficient and reusable entity instantiation through its caching mechanism and
48- * provides a robust support for mapping result set columns to entity properties, even in cases
49- * involving complex associations and aggregation strategies.
5046 */
5147public class LinkableEntityPoolProvider extends AbstractObjectProvider <LinkableEntityPool > {
5248
@@ -85,25 +81,14 @@ public LinkableEntityPoolProvider(
8581
8682 @ Override
8783 public LinkableEntityPool get (ResultSet resultSet ) throws SQLException {
88- List <MappingSupport .Prop > props = cratesProps (resultSet );
84+ List <MappingSupport .Prop > props = createProps (resultSet );
8985 Map <AssociationIdentifier , List <MappingSupport .Prop >> propGroup =
9086 groupPropsByAssociationIdentifier (props );
9187 return createEntityPool (propGroup );
9288 }
9389
94- /**
95- * Processes the given ResultSet and constructs a list of MappingSupport.Prop objects. Each Prop
96- * object is created by extracting the raw value from the ResultSet using the associated property
97- * type and its index, as defined by the indexMap. If the indexMap is null, it initializes it by
98- * creating a column name mapping and determining the appropriate indexes based on the ResultSet's
99- * metadata.
100- *
101- * @param resultSet the ResultSet from which property values are extracted, must not be null
102- * @return a list of MappingSupport.Prop objects, each representing a property with its extracted
103- * value
104- * @throws SQLException if a database access error occurs
105- */
106- private List <MappingSupport .Prop > cratesProps (ResultSet resultSet ) throws SQLException {
90+ /** Processes the given ResultSet and constructs a list of MappingSupport.Prop objects. */
91+ private List <MappingSupport .Prop > createProps (ResultSet resultSet ) throws SQLException {
10792 assertNotNull (resultSet );
10893 if (indexMap == null ) {
10994 Map <String , MappingSupport .PropType > columnNameMap = createColumnNameMap ();
@@ -122,15 +107,7 @@ private List<MappingSupport.Prop> cratesProps(ResultSet resultSet) throws SQLExc
122107 return props ;
123108 }
124109
125- /**
126- * Creates a column name mapping for the entity type associated with this provider. This method
127- * retrieves the entity property types and populates a map where column names are keys and their
128- * corresponding property types are values. It also ensures that the mapping includes appropriate
129- * table aliases for column names to avoid conflicts.
130- *
131- * @return a map where the keys are column names (with applied table aliases) and the values are
132- * corresponding {@link MappingSupport.PropType} objects
133- */
110+ /** Creates a column name mapping for the entity type associated with this provider. */
134111 private Map <String , MappingSupport .PropType > createColumnNameMap () {
135112 List <? extends EntityPropertyType <?, ?>> propertyTypes = entityType .getEntityPropertyTypes ();
136113 Map <String , MappingSupport .PropType > result = new HashMap <>(propertyTypes .size ());
@@ -143,15 +120,6 @@ private Map<String, MappingSupport.PropType> createColumnNameMap() {
143120 * type and its properties. This method recursively processes entity properties and association
144121 * properties to populate the given map with column names and corresponding property type
145122 * information.
146- *
147- * @param map a map where column names (in a prefixed, lowercase format) are mapped to their
148- * corresponding {@link MappingSupport.PropType} values
149- * @param source the {@link EntityType} representing the source entity for which column names and
150- * property types are being collected
151- * @param propertyPath the property path used to identify the hierarchy of properties, allowing
152- * proper association handling
153- * @param tableAlias the table alias used as a prefix for column names to ensure uniqueness across
154- * multiple joined tables
155123 */
156124 private void collectColumnNames (
157125 Map <String , MappingSupport .PropType > map ,
@@ -182,13 +150,7 @@ private void collectColumnNames(
182150
183151 /**
184152 * Groups a list of {@link MappingSupport.Prop} objects by their associated {@link
185- * AssociationIdentifier}. The grouping is determined based on the combination of the property
186- * path and entity type for each property.
187- *
188- * @param props a list of {@link MappingSupport.Prop} objects representing entity properties to be
189- * grouped
190- * @return a map where the keys are {@link AssociationIdentifier} objects and the values are lists
191- * of {@link MappingSupport.Prop} objects grouped by their association identifier
153+ * AssociationIdentifier}.
192154 */
193155 private Map <AssociationIdentifier , List <MappingSupport .Prop >> groupPropsByAssociationIdentifier (
194156 List <MappingSupport .Prop > props ) {
@@ -200,15 +162,7 @@ private Map<AssociationIdentifier, List<MappingSupport.Prop>> groupPropsByAssoci
200162
201163 /**
202164 * Creates and populates a {@link LinkableEntityPool} based on the provided group of properties
203- * organized by their {@link AssociationIdentifier}. The method processes the given properties,
204- * checks their validity, determines the appropriate keys and states, and associates the created
205- * entities with a unique key in the pool. It ensures caching and state preservation for entities.
206- *
207- * @param propGroup a map where keys are {@link AssociationIdentifier} objects representing the
208- * association identifiers and values are lists of {@link MappingSupport.Prop}, which define
209- * properties for the entities within that association.
210- * @return a {@link LinkableEntityPool} containing the processed and created entities organized by
211- * their associations.
165+ * organized by their {@link AssociationIdentifier}.
212166 */
213167 private LinkableEntityPool createEntityPool (
214168 Map <AssociationIdentifier , List <MappingSupport .Prop >> propGroup ) {
0 commit comments