Questions tagged [dozer]

Dozer is a Java Bean to Java Bean mapper that recursively copies data from one object to another. Typically, these Java Beans will be of different complex types.

From the Dozer website:

Dozer is a Java Bean to Java Bean mapper that recursively copies data from one object to another. Typically, these Java Beans will be of different complex types.

Dozer supports simple property mapping, complex type mapping, bi-directional mapping, implicit-explicit mapping, as well as recursive mapping. This includes mapping collection attributes that also need mapping at the element level.

Dozer not only supports mapping between attribute names, but also automatically converting between types. Most conversion scenarios are supported out of the box, but Dozer also allows you to specify custom conversions via XML.

530 questions
10
votes
4 answers

Dozer: Mapping of class with no default constructor

Lets say I want to map the following two classes: public class A { String member; public void setMember(String member) { this.member = member } public String getMember() { return member } } public class B { String member; …
Sebi
  • 2,534
  • 2
  • 26
  • 28
10
votes
2 answers

A dozer map exception related to Spring boot devtools

I have encountered a very strange exception, and I don't know how to find the reason. Business background: Add goods and meantime it's price list, a goods have 5 price for diff level user. In controller, first convert goodForm to goods by using…
zhuguowei
  • 8,401
  • 16
  • 70
  • 106
9
votes
1 answer

Dozer mapping inner classes

I need to map class A into class C using dozer framework. public class A { private String fielda1; private String fielda2; public String getFielda1() { return fielda1; } public void setFielda1(String fielda1) { this.fielda1 =…
dino.keco
  • 1,401
  • 1
  • 12
  • 18
8
votes
3 answers

NoSuchMethodException: java.time.LocalDateTime.() reading CSV using Super CSV

I have written an entity that contains just a LocalDateTime to a CSV file using Super CSV's ICsvDozerBeanWriter and I am encountering an error when reading it back using a ICsvDozerBeanReader. I was able to successfully read and write a Date object…
Stuart Leyland-Cole
  • 1,243
  • 7
  • 19
  • 35
8
votes
1 answer

Dozer trying to map a class to its interface

With my data model, which is basically a tree with parents children, Dozer is having issues successfully mapping them as it interprets a field (which uses an interface-type as a parameter) as being a class, and trying to instantiate it with a…
DavidH
  • 223
  • 2
  • 13
7
votes
5 answers

Constants in dozer mappings

does anybody know how to put a constant value into an attribute with dozer? I haven't seen anything about that in the dozer's documentation
Pau
7
votes
2 answers

BeanUtils.copyProperties() vs DozerBeanMapper.map()

I am using BeanUtils.copyProperties() for bean to dto mapping when I need to map all fields and field names are same. But I need not all field of source bean to map in destination dto, I used DozerBeanMapper.map() , because I haven't idea about to…
Pankaj Kumar
  • 81,967
  • 29
  • 167
  • 186
7
votes
2 answers

A classloader problem related to spring-boot-devtools

Background: Spring boot project, add goods and goods price list Goods: List pricelist; in controller first convert goodsForm to goods(by dozer), then save goods,after saving goods iterate goods price list to populate…
zhuguowei
  • 8,401
  • 16
  • 70
  • 106
7
votes
3 answers

Copy pojo fields to another pojo's setters

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…
vertti
  • 7,539
  • 4
  • 51
  • 81
7
votes
1 answer

Dozer and Spring integration

EDIT : A new lib has been introduced which clarify the thing for new versions Since version 5.5.0 Spring integration comes within additional module dozer-spring. Hi there I'm relatively new to Dozer and Spring and a bit confused about how to…
Michael Laffargue
  • 10,116
  • 6
  • 42
  • 76
7
votes
2 answers

Dozer 5.3.2. Programmatically set custom converters?

How do I programmatically set custom converter for dozer? The following code doesn't work: Custom Converter implementation: class ConverterImpl extends DozerConverter { ConverterImpl() { super(A.class, B.class); } @Override public B…
andrew.z
  • 1,039
  • 3
  • 15
  • 24
7
votes
1 answer

Configure custom converters using Dozer Java API

I am trying to use Dozer Java API to map two java classes using a custom converter. Is there a way I can configure class-level custom converters in Java? Right now I have to add the configuration in XML:
dchen
  • 105
  • 1
  • 5
6
votes
0 answers

Dozer mapping generic types

I want to map a data object to basically the same transport object using dozer. The objects contain a generic field. I expect the generic field to be mapped to the same type, in this example to be Integer. But the mapped object generic type is…
Fabian Hertwig
  • 1,093
  • 13
  • 27
6
votes
1 answer

Dozer custom converter ID mapping: Object to Long and Long to Object via DozerConverter getParameter

I need help configuring my dozer mapping file. Mainly I would like to know how to get User user obejct to convert to Long userId. Hence map: user >> userId But I have multiple objects such as comment >> commentId or address >> addressId therefor…
MatBanik
  • 26,356
  • 39
  • 116
  • 178
6
votes
2 answers

Dozer Mapping HashMap to List

I have a source object which has: public class Source { public MapgetDTOs(); } and a destination object: public class Destination { public List getDTOs(); public void setDTOs(List dtos); } I'm trying to use Dozer…
Idcmp
  • 659
  • 1
  • 8
  • 19
1
2
3
35 36