Class ProfileMapperImpl

java.lang.Object
com.alpaca.mapper.impl.ProfileMapperImpl
All Implemented Interfaces:
GenericMapper<Profile,ProfileResponseDTO,ProfileRequestDTO>, IProfileMapper

@Component public class ProfileMapperImpl extends Object implements IProfileMapper
Implementation of IProfileMapper for mapping between Profile entities and their corresponding request and response DTOs.

This class uses IUserService to resolve the User entity from the given user ID in the request DTO when constructing a Profile entity.

Responsibilities:

  • Convert a Profile entity to ProfileResponseDTO, including nested user details.
  • Construct a Profile entity from ProfileRequestDTO, resolving the associated User.
  • Transform collections of Profile entities into lists of ProfileResponseDTOs.
  • Handle null or empty inputs gracefully by returning null or empty collections.

This class is annotated with Component to enable Spring's dependency injection and uses Lombok's RequiredArgsConstructor for constructor-based injection (if required in future).

See Also: