Class CollectionHydrator
java.lang.Object
nl.datasteel.crudcraft.projection.impl.CollectionHydrator
Utility class that hydrates collection attributes for projection DTOs.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordResult returned by theCollectionHydrator.RowFetchercontaining the fetched rows and the Java types of the joined associations.static interfaceFunctional interface used to fetch collection data for a given entity type. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,D> void hydrateCollections(Class<T> entityType, ProjectionMetadata<D> metadata, Map<Object, D> dtoMap, CollectionHydrator.RowFetcher fetcher) Hydrates collection attributes in the DTO map by fetching the necessary data from the database.
-
Method Details
-
hydrateCollections
public static <T,D> void hydrateCollections(Class<T> entityType, ProjectionMetadata<D> metadata, Map<Object, D> dtoMap, CollectionHydrator.RowFetcher fetcher) Hydrates collection attributes in the DTO map by fetching the necessary data from the database.- Parameters:
entityType- the type of the entity being projectedmetadata- the projection metadata for the DTO typedtoMap- a map of IDs to DTO instances to hydratefetcher- a function that fetches collection data for the given entity type
-