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
6
votes
4 answers

With dozer is it possible to map several fields to one field?

We have some legacy data we are attempting to map... The legacy data has fields for month day year... Is it possible to convert MyObject.day MyObject.year MyObject.month to MyOtherObject.date I could not find any documentation on this subject. Any…
AnthonyJClink
  • 1,008
  • 2
  • 11
  • 32
6
votes
0 answers

class not found exception in Dozer

I am trying to execute below dozer example. my class file is inside classes folder, but i am getting the class not found exception. org.dozer.MappingException: java.lang.ClassNotFoundException: portal.control.profile.ChangeProfileRequest at…
Rajesh Narravula
  • 1,433
  • 3
  • 26
  • 54
6
votes
3 answers

Why do we need a bean to bean mapper like dozer in a web application

In simple terms, why do we need 'a bean to bean mapping service' (like Dozer) in a web-application. Suppose I'm working on a web-service. I'm receiving an XML in request. I fetch the the values from XML elements. Perform the required operation on…
reiley
  • 3,759
  • 12
  • 58
  • 114
6
votes
3 answers

Mapping deep properties with intermediate collections in dozer

Suppose I have the following classes public class Baz { private List foos = new ArrayList(); } public class Foo { private String string; } public class Target { private List fooStrings = new ArrayList(); } Is there…
Jherico
  • 28,584
  • 8
  • 61
  • 87
6
votes
1 answer

How to turn off debugging for just dozer?

Is there a way to turn off debug logging for just dozer? At least without having to increase it above the debug level?
Stephane Grenier
  • 15,527
  • 38
  • 117
  • 192
6
votes
1 answer

Non-trivial Dozer mappings

I'm struggling to get Dozer to bend to my will for something that I feel should be quite simple. I have two similar models that I wish to map between, however one has a 'deeper' hierarchy than the other and this is causing me problems when dealing…
teabot
  • 15,358
  • 11
  • 64
  • 79
5
votes
1 answer

Mapping value objects with Dozer

I'm using Dozer to map my DTOs to JPA entities. One of the use-cases is that a DTO representation of an already existing entity arrives on a WS, then I find the entity using JPA and use Dozer to map the DTO on the found entity using map(source,…
nihilist84
  • 1,191
  • 3
  • 11
  • 20
5
votes
1 answer

Dozer, how to ignore a field with annotation

I'm using dozer to map objects. How can I ignore (exclude) a field using annotations with dozer? Something like: class A { @IgnoreField public String someField; } class B { public String someField; } …
satellite satellite
  • 893
  • 2
  • 10
  • 27
5
votes
1 answer

Dozer, how to convert a map to a list of complex types

I am struggling with a Dozer mapping. I would like to convert a java.util.Map to a java.util.List. My classes are implemented as follows. public class A { private List values; } class B { private Map
saw303
  • 8,051
  • 7
  • 50
  • 90
5
votes
1 answer

Dozer Mapping from Object with Map to Pojo with properties

I am trying to do a oneWay Mapping with Dozer from Source to Destination. public class Source { Map values; public Source() { } public Source(Map values) { this.values = values; } …
Phil
  • 133
  • 5
5
votes
4 answers

How can I tell Dozer to bypass mapping null or empty string values per field using the programming api?

The faq explains how to do this in XML. This shows how to do it per class using the API. The problem is you have to set it on on the class. What if I only want it on one field? Is this possible?
Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
5
votes
1 answer

DTO to Entity And Entity to DTO

We're to use DTO's to send data to and from the presentation layer. We have layers like: facade appService domain And We have use Dozer to help us convert entity to dto. But i have 2 question now: from entity to dto we can use dozer, but from…
tobato
  • 65
  • 1
  • 1
  • 3
5
votes
2 answers

Dozer: get first value on a collection mapped to single value in destination

I am mapping two DTO objects through Dozer mapper. I am interested in choosing one value from list and map it to a single field in the destination file. Is it possible to use mapping like this: someList[0]
mico
  • 12,730
  • 12
  • 59
  • 99
4
votes
2 answers

Converting a nested collection using Dozer

I have a class A which has a nested set of class B: public class A { private Set children; } public class B { private int value; } I also have a class C which has a nested set of class D: public class C { private Set
Naresh
  • 23,937
  • 33
  • 132
  • 204
4
votes
1 answer

How to map a field with type as an abstract class with dozer?

I have the following domain structure: abstract class Person { String name; //with getter and setter } class Employer extends Person {} class Employee extends Person {} class Contract { Person contractor; //with getter and setter } class PersonDTO…
fabien7474
  • 16,300
  • 22
  • 96
  • 124
1 2
3
35 36