Copy pojo fields to another pojo's setters
dozer, java, pojo
Solution
I'd suggest you use:
http://modelmapper.org/
Or take a look at this question:
Copy all values from fields in one class to another through reflection
I'd say that both API's (BeanUtils) and ModelMapper provide one-liners for copy pojos' values to another pojos. Take a look @ this:
http://modelmapper.org/getting-started/
Problem
Let's say I have class `A` with public fields `x` and `y`. And let's say I have another pojo class `B` but that uses setters and getters, so it has setX() and setY(). I'd like to use some automatic way to copy from instance of `A` to `B` and back. With default settings at least, Dozer's ``` Mapper mapper = new DozerBeanMapper(); B b = mapper.map(a, B.class); ``` does not copy the fields correctly. So is there a simple configuration change that allows me to accomplish the above with Dozer, or another library that would do this for me?