java.lang.Object
org.litebridge.orm.persistence.SelectSpecDtoMapper
The SelectSpecDtoMapper class is responsible for mapping data from rows of a database query to DTO (Data Transfer Object) instances.
It facilitates the conversion of raw query results into structured DTO objects by using specifications, type conversions,
table metadata, and a context for orchestration.
This class provides a flexible mechanism to handle complex mapping scenarios, including resolving dependencies between DTOs, handling related data through one-to-one, one-to-many, and many-to-many relationships, and processing data as per the blueprint defined for DTO creation.
This class supports custom mapping logic, lazy-loading of dependencies, and handling of various relationship types among DTOs.
-
Constructor Summary
ConstructorsConstructorDescriptionSelectSpecDtoMapper(DtoSelectSpec dtoSelectSpec, TypeConverter typeConverter, TableRegistry tableRegistry, DtoConstructor dtoConstructor, LitebridgeContext litebridgeContext) Constructs a new instance of the SelectSpecDtoMapper, initializing the required dependencies for mapping database query results into Data Transfer Objects (DTOs). -
Method Summary
-
Constructor Details
-
SelectSpecDtoMapper
public SelectSpecDtoMapper(DtoSelectSpec dtoSelectSpec, TypeConverter typeConverter, TableRegistry tableRegistry, DtoConstructor dtoConstructor, LitebridgeContext litebridgeContext) Constructs a new instance of the SelectSpecDtoMapper, initializing the required dependencies for mapping database query results into Data Transfer Objects (DTOs).- Parameters:
dtoSelectSpec- The DTO selection specification, which provides the blueprint for mapping database rows to DTOs.typeConverter- The type converter responsible for converting database values into the appropriate type used in DTO fields.tableRegistry- The registry containing metadata about database tables, used for resolving table and column mappings.dtoConstructor- The constructor utility used to instantiate DTO instances during the mapping process.litebridgeContext- The operational context that encapsulates system-wide configurations required for the mapping and object construction.
-
-
Method Details
-
toDtos
Converts a list of database rows into a list of DTO (Data Transfer Object) instances of the specified type.- Type Parameters:
DTO- The generic type of the DTO to which the rows will be mapped.- Parameters:
dtoClass- The target DTO class to which the rows should be converted.rows- The list of database rows to be converted into DTOs.- Returns:
- A list of DTOs of the specified type, created by mapping the given rows.
-