-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
In real life use cases (especially with libraries like Room), we often deal with nested/embedded objects.
For example:
data class AccountWithCurrencies(
@Embedded
val account: Account,
@Relation(
parentColumn = "id",
entityColumn = "accountId"
)
val currencies: List<AccountCurrency>
)Currently, to map it into a DTO:
@KOMMMap(from = [AccountWithCurrencies::class])
data class AccountDto(
val name: String,
val currencies: List<AccountCurrencyDto>
) {
var id: Long = 0L
internal set
}…we need to use two explicit converters:
@KOMMMap(from = [AccountWithCurrencies::class])
data class AccountDto(
@MapConvert<AccountWithCurrencies, AccountDto, NameConverter>(NameConverter::class, "account")
val name: String,
val currencies: List<AccountCurrencyDto>
) {
@MapConvert<AccountWithCurrencies, AccountDto, IdConverter>(IdConverter::class, "account")
var id: Long = 0L
internal set
}Potential solution
Introduce an Embedded mapping feature.
This would allow specifying the source property once, so that multiple fields can be mapped from it.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request