Mapstruct with Immutable Object (@Value of Lombok) What is the best strategy?

558 views
Skip to first unread message

Estevão Jordão

unread,
Dec 18, 2017, 8:52:52 PM12/18/17
to mapstruct-users

I would very much like everyone's help on how to map Immutable objects (using @Value from Lombok) with Mapstruct.

I looked at the Mapstruct documentation and noticed that we can use the writing strategy for DefaultAccessorNamingStrategy.


What would be the best way to do this? If possible, would you have examples?

Since I have observed many people asking the same thing, but I have not found any real examples of the solution to this problem / strategy


Thanks in advance for your help and support. :)

Filip Hrisafov

unread,
Jan 20, 2018, 6:02:15 AM1/20/18
to mapstruct-users
Hi,

If your builder has a different naming strategy than you can provide a custom DefaultAccessorNamingStrategy for it. You can also have a look at a small strategy that I have written that supports builders (https://github.com/filiphr/mapstruct-builder-accessor).

Apart from the Strategy, you would need to perform the converting. Have a look at this comment in the feature request for the builder on how to do it for now.

Cheers,
Filip
Reply all
Reply to author
Forward
0 new messages