Closed bclozel closed 12 years ago
I have not a clear view of why is it better than a simple DTO + copy contructor, could you explain ?
A copy constructor in the DTO class? For that, we have to create a project-contract -> project-core dependency (thus killing our separation of concerns).
Another solution would be to create Converter classes in the project-core module - exactly what model mappers do (with a better approach).
Did I miss something?
No you don't ;-)
If modelmapper is available from central, feel free to add the dependency in resthub-web-common pom.xml and add documentation to resthub.org.
If it is not available from central, please only add the documentation.
There is also a Spring integration ! http://modelmapper.org/user-manual/extensions/
Yes, its simple design and the spring integration made me reconsider using https://github.com/DozerMapper/dozer (which is still a good option).
Anyway we should really think this through, and question why many developers think DTOs are a bad practice because it requires maintaining to parallel (often similar) hierarchies.
I think I prefer modelmapper too (very simple to use). And it is in Central (http://search.maven.org/#search%7Cga%7C1%7Cmodelmapper) !
For Model<->DTOs conversion, we should check out https://github.com/jhalterman/modelmapper .
We don't have to include it in RESThub - maybe a short chapter in the documentation could be enough.