Closed peter-si closed 2 years ago
Hi @peter-si, thank you for creating this issue.
fromProperty / fromMethod
Seems a useful operation - if you open up a PR for this I'll gladly merge it!
Polymorphism
What's the behaviour here - loop through each option provided, and map to the first target for which a mapping exists? Seems a useful addition as well!
I'm not sure about the name though, mapToMultiple
implies mapping to a collection of some sorts (at least to me). I can't come up with a good alternative myself either... Maybe mapToOneOf
?
Ok, I'll do it today. And yes, that's exactly how I pictured that polymorphism feature. I'm not too attached to mapToMultiple
, so mapToOneOf
it is
Oh right a bit of misunderstanding on my part. My goal was to have an array of objects mapped to a different array of objects. Not single value to one of provided classes (it can work both way though). So in that regart mapToOneOf
is not a good name since we won't necessarily get a single value
As discussed in #70, this has been implemented as MapToAnyOf
.
Hi, I would like to add 2 operations and wanted to know if it is wanted or can't be done already with some other operations. I'll start with the easier one:
fromProperty
we have quite a few mappings like this
this could be quite easily done with something like
mapToMultiple
the more complicated one - support polymorphism. Sometimes we have a collection of different objects (e.g. with single table inheritance) and we would like to map them to different set of objects. Currently we are doing it like this:
My idea is to create an operation which would look like this