Package com.dmasone.identity.api.mapper
Interface UserMapper
public interface UserMapper
Maps between generated API models and the internal user entity.
MapStruct generates the implementation at build time, keeping the mapping explicit and compile-time checked without hand-written boilerplate.
-
Method Summary
Modifier and TypeMethodDescriptiondefault OffsetDateTimeConverts persistence timestamps to API-friendly offset timestamps.toEntity(com.dmasone.identity.api.generated.model.CreateUserRequestV1 request) Converts a v1 creation request into a new user entity.toEntity(com.dmasone.identity.api.generated.model.CreateUserRequestV2 request) Converts a v2 creation request into a new user entity.com.dmasone.identity.api.generated.model.UserResponseV1Converts a domain user into the version 1 API response.com.dmasone.identity.api.generated.model.UserResponseV2Converts a domain user into the version 2 API response.
-
Method Details
-
toV1
Converts a domain user into the version 1 API response.- Parameters:
user- persisted user entity- Returns:
- user representation exposed by the v1 API
-
toV2
Converts a domain user into the version 2 API response.- Parameters:
user- persisted user entity- Returns:
- user representation exposed by the v2 API
-
toEntity
Converts a v1 creation request into a new user entity.Generated identifiers, timestamps, status, and password hash are set by the service layer because they belong to application behavior, not request mapping.
- Parameters:
request- validated v1 API request- Returns:
- a new user entity ready for service enrichment
-
toEntity
Converts a v2 creation request into a new user entity.- Parameters:
request- validated v2 API request- Returns:
- a new user entity ready for service enrichment
-
map
Converts persistence timestamps to API-friendly offset timestamps.- Parameters:
instant- timestamp stored by the domain model- Returns:
- UTC offset timestamp for generated OpenAPI responses
-