Class RaceMapper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmapWithEvent(Race entity) mapWithoutDistanceWithEvent(Race entity)
-
Constructor Details
-
RaceMapper
public RaceMapper()
-
-
Method Details
-
map
Maps aRaceentity to aRaceDTO.This method navigates through the race's courses and its distance to populate the sports and distance metadata fields. The caller must ensure that courses and their distances are eagerly fetched to avoid lazy-initialization errors. This method doesn't populate the
RaceDTO.event()field in the RaceDTO; usemapWithEvent(Race)if event data is needed.- Parameters:
entity- the Race entity to be mapped- Returns:
- the corresponding RaceDTO, or
nullif the entity isnull
-
mapWithEvent
Maps aRaceentity to aRaceDTOincluding the parentEventdata.Unlike
map(Race), this method navigates through the race's courses to populate theRaceDTO.event()field with the associatedEventinformation. The caller must ensure that courses and their events and distances are eagerly fetched to avoid lazy-initialization errors.- Parameters:
entity- the Race entity to be mapped- Returns:
- the corresponding RaceDTO with event data, or
nullif the entity is null
-
mapWithoutDistanceWithEvent
Maps aRaceentity to aRaceDTOwith courses and event data but without distance information.Unlike
mapWithEvent(Race), this method does not navigate through the courses' distances. The resultingRaceDTOhas anulldistance metadata, and the event populated from the first course. The caller must ensure that courses and their events are eagerly fetched to avoid lazy-initialization errors.- Parameters:
entity- the Race entity to be mapped- Returns:
- the corresponding RaceDTO with event data, or
nullif the entity isnull
-