Open petromir opened 7 years ago
Hi @petromir, There is currently no automation, default values are on the roadmap, meanwhile the only option is to use a static method only to encapsulate the mapping.
@avurro Could you please provide an example?
Hi @petromir,
Actually looking better there is no way to encapsulate the mapping, but you gave me a good idea, that is to add a new placeholder that allows access to the root of the field, something like that: ${source.root}
and ${destination.root}
would be useful.
What do you think about it ?
Hi @avurro, Whatever you think will help us. Just provide few examples and probably a wiki article.
I ran across a similar situation where I wanted to map two fields firstName
and lastName
onto one destination field fullName
. I've been looking at global mappings and converters but nothing seems to fit the bill.
I'd like to do something like:
<!-- This is not working of course -->
<attribute name="fullName">
<value>return ${source.root.firstName} + " " + ${source.root.lastName};</value>
</attribute>
Would that head into the same direction?
Hi,
I read about similar case here https://github.com/jmapper-framework/jmapper-core/wiki/Flatten-And-Encapsulate, but I couldn't match it to my case. So here it is:
What annotation should be placed in the
Dto
in order to have a list ofNestedEntity
objects, which have same data located indata
andtext
fields and differentid
taken from each item inids