How to map optional fields with MapStruct

    Nick Tinnemeier, on 5-02-2021
    Category: Development

    Introduction MapStruct is a framework that alleviates us, programmers, from the unexciting task of writing code to copy one object model to another, field by field. In this blog we show you how to map optional fields with MapStruct. If, after reading this, you still wonder what MapStruct is and what it can do for you, then this blog could answer those questions for you: https://techlab.bol.com/mapping-object-models-case-study/. This blog zooms in on MapStruct’s capabilities of dealing with source fields that are not always present, i.e. might be null. In particular, we…

    Read more

    How to write MapStruct mappers for object hierarchies

    Nick Tinnemeier, on 1-02-2021
    Category: Development

    Introduction MapStruct is a framework that alleviates us, programmers, from the unexciting task of writing code to copy one object model to another, field by field. This blog elaborates on how to write MapStruct mappers for object hierarchies. If, after reading this, you still wonder what MapStruct is and what it can do for you, then this blog might be a good read: https://techlab.bol.com/mapstruct-case-study/. To already spoil the fun, MapStruct is not able to generate mappers for classes that all inherit from the same (abstract) base class or interface. In…

    Read more