Suppose I have following Class – structure ?
class A{
List<B> listB;
//getter and setter
}
class B{
String s;
//getter and setter
}
//objectOfA has listB = [null,objectOfB,null]
A a2 = dozermapper.map(objectOfA,A.class);
I want a2 contains listB=[objectOfB] only. not null elements of list.
How to do it in dozer?
You could write a simple converter, like this (uses new converter api, you can use old also):
and then attach it to your mapping like this: