androidimmutabilitymapstructauto-value

How to use MapStruct for immutable value class by AutoValue (for Android)


I cannot figure out how to use mapstruct 1.3 with Google's @AutoValue. I'm trying to do it on Android, but I doubt that is related to my issues. Are there any documentation on this or examples? I've posted in the maptruct issues regarding lack of documentation.

AutoValue builds an immutable bean, and the builder is created via a method I supply, MyDto.builder(), which returns new AutoValue_MyDto.Builder()


Solution

  • I finally figured it out. I have updated examples here, for others to see how it plays together.

    https://github.com/abeade/mapstruct-test

    and my fork

    https://github.com/arberg/mapstruct-test

    Builders just works out of the box, no special annotation, besides @Mapping. But there seem to be many limitations, and I ran into many of them. It also seems to just work on Android.