Is there Java equivalent of .Net's Automapper?
Asked
Active
Viewed 2.6k times
53
-
3If you could tell us what Automapper does in .NET, then we Java-freaks could answer as well ;-) – Joachim Sauer Jul 23 '10 at 14:38
-
@Joachim Sauer http://automapper.codeplex.com – Omu Jul 26 '10 at 13:56
-
2Despite this question being closed, it contains a lot of great information! There are many other mappers not mentioned here. Please see this article for a great comparison of examples and performance (2018): https://www.baeldung.com/java-performance-mapping-frameworks – jocull Feb 01 '19 at 21:29
3 Answers
27
Checkout the Dozer project.
Dozer supports simple property mapping, complex type mapping, bi-directional mapping, implicit-explicit mapping, as well as recursive mapping.
It makes use of BeanUtils and extends on it.
-
Future readers, keep in mind that Dozer is one of the slowest mappers available. This may or may not matter for you depending on your usage :) – jocull Feb 01 '19 at 21:29
23
Check out my ModelMapper. It was inspired by AutoMapper, but adds a few new things such as intelligent mapping.
ModelMapper is an intelligent object mapping framework that eliminates the need to manually map objects to each other. It uses a convention-based approach to map objects while providing a simple refactoring safe API for handling specific mapping scenarios.
Also a brief blog post from Jimmy Bogard, the creator of AutoMapper:
http://lostechies.com/jimmybogard/2012/09/17/automapper-for-java/
-
Be aware of this issue if writting custom mappings: https://github.com/jhalterman/modelmapper/issues/87 I just ran in to this one at it's thrown a bit of a spanner in the works! – Chris Nevill Aug 27 '14 at 15:41
-
1ModelMapper appears really powerful. As someone coming from C#/AutoMapper background, I would recommend checking this out. – Patrick Michaelsen May 30 '19 at 01:09