The SimpleFlatMapper library has the ability to map between data and POJO objects but what I would like to find out if it can map between a POJO object and a Map?
This is so that I can use it in a library (https://github.com/markash/komparator) that I am busy with performs comparisons and the ultimate goal is to be able to do the following:-
List<BusinessPojo> firstList = ...;
DataRecordSet recordSet01 =
ObjectParser
.mapTo(Map.class)
.stream(firstList, convertToDataRecord)
.collect(DataRecordSet.collect);
List<BusinessPojo> secondList = ...;
DataRecordSet recordSet02 =
ObjectParser
.mapTo(Map.class)
.stream(secondList, convertToDataRecord)
.collect(DataRecordSet.collect);
List<DataDifferences> results = recordSet01.compareWith(recordSet02);
The visual end result is https://mpashworth.wordpress.com/2017/07/09/calculating-string-differences/
It does not support that outside the box, there is no implementation supporting Map as a source or target at the moment.
I assume you would like to have a map each property to a key - value pair in the map with the key as some form of normalized key path, kind of a flattened JSON.
You could implement your own mapper, but it's not that trivial, what would be the type of the value?
You might be better off looking at a POJO -> Json -> flatten json transformation.
Saying that in theory it's doable, might have a look at it.