MapStruct 1.3.0.Final is out in the wild

Long overdue it is our pleasure to announce the final version MapStruct 1.3. This is our 3rd release since november 2015.

Besides bug fixes, the 1.3 release brings some new exciting features:

  • Mapping (immutable) objects using builders
  • Enhanced and more flexible update method (@MappingTarget) handling
  • Constructor injection for Annotation Based component models
  • Source policy for unmapped source properties (unmappedSourcePolicy)
  • Support for defaultExpression
  • Limit mapping only to explicitly defined mappings
  • Performance improvement of constant / defaultValue primitive to String mappings
  • Warnings for precision loss

For more details checkout the individual release announcements for the Beta1 and Beta2 releases.

What’s inside

First and foremost we have delivered the ability to cope with immutable beans via the builder pattern. There are many frameworks out there for which we added (experimental) support, most notably Immutables, Lombok and Protobuf.

We haven’t forgotten the initialization via a constructor, it is high on our list to support it within the next release.

Next we realised that the way we handle update / merge methods (@MappingTarget) deserved more attention. Initially this functionality was modelled after the non update methods (regular mappings), but the use case for these types is different. The API behaved inconsistent and left the user unable to choose what to do in case of null or not present source objects:

  • Set null
  • Set default
  • Ignore and leave the target as is

This can now be controlled via NullValuePropertyMappingStrategy.

We also dropped support for Java 6 an 7 in 1.3 and are using Java 8 as a baseline across the MapStruct codebase. This has been long overdue and would enable us to simplify our codebase. It would also allow us to spent our effort on newer features rather than backwards compatible support for Java 6 and 7.

In total 105 have been fixed between the 1.2.0.Final and 1.3.0.Final releases.

What’s next

Functionality wise many features have been added since the 1.0.0.Final release. Some of these features would have justified major releases, but we chose to be very careful. Bringing out a number of beta releases and release candidates we tried to mitigate risks. Perhaps we are too careful, looking at the issues that are found on the new features and we should be more daring in bringing out minor releases faster.

Development wise, in many ways, we are standing on a crossroad. Our code base has grown and the handling of beans / property mapping has grown complex. It is time to look at restructuring the code in a major fashion if we want to grow in features. Don’t let this scare you, the public API exposed by MapStruct will not change. We are only talking about the internal API of the processor. All of our tests are done in such way that they are only using the MapStruct public API. Each test has a mapper for which the compiler is invoked to generate the implementation and we test against that. This tests give us confidence that we can restructure the code and keep everything working as is now. During this refactoring we want to drop some of our deprecated features. The refactored code will most likely lead to a 2.0 version and will be done transparently with the community. In between 1.3 and 2.0 we plan smaller and faster feature / bug fix releases.

We are also going to scrutinise our open issues and close the ones which will not make it into MapStruct. In case we close your issue and you think that it should be a feature or enhancement from MapStruct, then please say so in the issue and we can reconsider.

One other big feature that we would like to see as soon as possible is the possibility to map via constructors. This has been one of the most requested features and we would like to tackle it.

If you have any ideas or are willing to help out with any features feel free to reach to us, we are always looking for new fresh ideas and support from the community.

Stats

We are very proud and thankful of our of our growing community. It is really satisfying to see how everyone helps each other in our Gitter Room, on StackOverflow or in our Google group. We currently have 1500+ stars and 50+ contributors on GitHub. More than 16000 people are using our IntelliJ plugin. And don’t worry we haven’t forgotten about it, a new fresh version with builder and fluent setter support will be released shortly.

Most impressive though are the download numbers we get from the Maven Central repo. As an example here are the numbers for the org.mapstruct:mapstruct-processor artifact:

Thanks

Last but not least we would like to congratulate all the enthusiastic MapStruct contributors making this release possible. In alphabetic order this are all the contributors that contributed to the 1.3 release of Mapstruct:

and of course seasoned MapStruct hackers hackers Sjaak Derksen, Filip Hrisafov, Christian Bandowski, Gunnar Morling and Andreas Gudian.

Happy coding with MapStruct 1.3!!

Download

You can fetch the new release from Maven Central using the following GAV coordinates:

Alternatively, you can get ZIP and TAR.GZ distribution bundles - containing all the JARs, documentation etc. - from GitHub.

If you run into any trouble or would like to report a bug, feature request or similar, use the following channels to get in touch:

comments powered by Disqus