Hi Filip.
Yes, the issue targets the same idea/requirement. So that means that currently there is no existing metainformation available at runtime right?
So switching over isn't an option for me at the moment. But thanks for the pointers!
Cheers
Veit
We also had the problem to access the Mapping Annotations at runtime.
We use MapStruct between a business-model and our ui-model.
When a UI client wants to get sorted data, it can specify a field from the ui-model.
Our MapStructParser can get the corresponding business-model field-name and create the needed Criteria to sort it.
We solved this problem by using ASM (bytecode manipulation and analysis framework)
to read the Mapping-Annotation and provide it in a meta model. At the end it's possible to write something like:
Example (Also available on Github)
The mappingInfo.mapToTargetField("plz") returns the mapped field of if the BusinessModel (zip).
The full runnable and tested example is available in here:
https://github.com/TobseF/mapstruct-metadata-example
StackOverflow:
https://stackoverflow.com/questions/62675889/