-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Map lists #65
Comments
This is a funny one. The linked solution using Looking at this a bit closer: What is your actual use case? Are you trying to define a |
indeed, I just want to convert a List to a List |
I have the same problem,I want to achieve such a requirement,I defined two mapperFirst: The second: public ConfigurationServiceAdapter( public List mapListToList(final List source) { public DeviceBrand mapDeviceBrandOptDTOToDeviceBrand(final DeviceBrandOptDTO source) { public AlarmCode mapAlarmCodeOptDTOToAlarmCode(final AlarmCodeOptDTO source) { public List mapListToList(final List source) { have two "mapListToList" method,how can i solve this problem |
Will have to look into this a bit. Until we can provide a full solution, the best thing I can suggest is not implementing the List Mapper as a Spring Converter and following standard MapStruct instead. |
Thank you and look forward to a better solution!!
|
Some notes:
|
It seems that mapping lists is not really possible, the generated code is not able to understand the type of the list:
I have also the same generated method 2 times if I have the conversion in the both directions. the compiler end up saying "name clash: mapListToList.... and mapListToList have the same type erasure"
For lists, another method should be used in the interface ConversionService (see this stackoverflow):
Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType)
It would be nice if the documentation could say something about this
The text was updated successfully, but these errors were encountered: