First, excellent job on mapstruct. Works very well, and compile time check works like a charm!
Te question I have is: Can I turn a List of something into a Object?
@Mapping(source = "complexInformation", target = "informationCount")Target count(List<Source> source);@Mapping(source = "complexInformation", target = "mostRelevantInformation")Target relevant(List<Source> source);@Mapping(source = "complexInformation", target = "infomationAverage")Target averate(List<Source> source);It would be more like a map->reduce scenario.Is there anything on mapstruct ready for that?
If not, is this something you guys would like to get (I can make and submit a pull request)?
Any help with the project is welcome :) Do you have any specific idea how such feature would look API-wise? I.e. in which way would the reduce logic be specified? I think as a first step it'd be helpful to relax the check mentioned above and allow for such methods if an expression is given.
Any help with the project is welcome :) Do you have any specific idea how such feature would look API-wise? I.e. in which way would the reduce logic be specified? I think as a first step it'd be helpful to relax the check mentioned above and allow for such methods if an expression is given.I had something like this in mind:@Mappings( {@Mapping(source = "collection", target = "count", transformation = CountTransformer.class),@Mapping(source = "collection", target = "average", transformation = AverageTransformer.class),@Mapping(source = "collection", target = "mostRelevant", transformation = MostRelevantTransformer.class)} )Target convert(Source source);CountTransformer would implement Transformer<List<String>, Long>AverageTransformer implements Transformer<List<String>, Double>MostRelevantTransformer implements Transformer<List<String>, String>
When using @Inject would allow way more complex transformations (if need of course)....Does it make any sense?
--
You received this message because you are subscribed to the Google Groups "mapstruct-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapstruct-use...@googlegroups.com.
To post to this group, send email to mapstru...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I guess only the @Inject ....That would open a ton of possibilities....When using @Mapper all is static right?!