-
-
Notifications
You must be signed in to change notification settings - Fork 1k
[Feature] Mapping hashmap from a field #1218
Copy link
Copy link
Open
Labels
Milestone
Description
When using the mapstruct library for mapping dto objects to domain objects a common problem encountered is the ability to map Hashmaps to object properties.
Existing code to acheive this is to use a custom function which will get a hashmap index from the map and return it.
@Mapper()
public abstract class OrderMapper {
@Mappings({
@Mapping(target="id", expression="java( getIdFlag(order, \"id\"))"),
})
abstract Order toDomainOrder order);
}
proposed syntax.
@Mapper()
public abstract class OrderMapper {
@Mappings({
@Mapping(target="id", expression="ids[id]"),
})
abstract Order toDomainOrder order);
}
is this something already being investigated or considered?
Reactions are currently unavailable