arnaudroger / SimpleFlatMapper

Fast and Easy mapping from database and csv to POJO. A java micro ORM, lightweight alternative to iBatis and Hibernate. Fast Csv Parser and Csv Mapper
http://simpleflatmapper.org
MIT License
439 stars 76 forks source link

Simple mapper between classes? #615

Closed Infeligo closed 4 years ago

Infeligo commented 5 years ago

This is a feature request. How about adding functionality for mapping between two classes? This could be somewhat similar to MapStruct, but less customizable.

The main use case that I think of is copy constructors (something that Lombok is not willing to support) and projections (a "view" of a bean with less fields). Of course, all of this could benefit from relaxed property matching.

What do you think of this idea?

arnaudroger commented 5 years ago

At first I’m not very inclined. There are library that do that well already as far as I now. What would be the benefit of supporting it here. What advantage over other libraries? But saying that it should be possible to implement something, we already have all the meta it’s just a matter of linking source prop to dest prop.

Infeligo commented 5 years ago

Well, I think you correct that there are great alternatives already. My first thought was that it would be nice to have something that does not use annotation processing like MapStruct does (for the sake of technological alternative), but there are already projects like Orika and ModelMapper which use byte-code generation. So yes, maybe it not worth it.