53

Is there Java equivalent of .Net's Automapper?

Roman
  • 19,581
  • 6
  • 68
  • 84
mgamer
  • 13,580
  • 25
  • 87
  • 145
  • 3
    If 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
  • 2
    Despite 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 Answers3

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.

http://modelmapper.org

Also a brief blog post from Jimmy Bogard, the creator of AutoMapper:

http://lostechies.com/jimmybogard/2012/09/17/automapper-for-java/

Makyen
  • 31,849
  • 12
  • 86
  • 121
Jonathan
  • 5,027
  • 39
  • 48
  • 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
  • 1
    ModelMapper appears really powerful. As someone coming from C#/AutoMapper background, I would recommend checking this out. – Patrick Michaelsen May 30 '19 at 01:09
2

You should check the open source project Beanutils from Apache Commons.

frm
  • 3,346
  • 1
  • 21
  • 21