Class UserMapper
java.lang.Object
tech.lastbox.lastshield.basicauth.mapper.UserMapper
@Component
@ConditionalOnProperty(name="lastshield.basicauth",
havingValue="true")
public class UserMapper
extends Object
Mapper class that provides the transformation between User entity and UserDTO.
The class is conditional on the 'lastshield.basicauth' property being set to true.
This class maps a UserDTO to a User entity and vice versa. It uses the UserRepository to fetch User entities based on UserDTO information.
-
Constructor Summary
ConstructorsConstructorDescriptionUserMapper(UserRepository userRepository) Constructor that injects the UserRepository. -
Method Summary
-
Constructor Details
-
UserMapper
Constructor that injects the UserRepository.- Parameters:
userRepository- the UserRepository instance for fetching User entities.
-
-
Method Details
-
toEntity
Maps a UserDTO to a User entity.- Parameters:
userDTO- the UserDTO instance to be converted.- Returns:
- the corresponding User entity.
-
toDto
Maps a User entity to a UserDTO.- Parameters:
user- the User entity to be converted.- Returns:
- the corresponding UserDTO.
-