I've wrote my own customer converter:
public class MyFancyCustomConverter extends DozerConverter<Integer, AnObject>
{
public MyFancyCustomConverter(Class<Integer> prototypeA, Class<AnObject> prototypeB)
{
super(prototypeA, prototypeB);
}
@Override
public AnObject convertTo(Integer source, AnObject destination)
{
// TODO: do something
return null;
}
@Override
public Integer convertFrom(AnObject source, Integer destination)
{
// TODO: do something
return 0;
}
}
And my mapping.xml:
<mapping>
<class-a>java.lang.Integer</class-a>
<class-b>xyz.AnObject</class-b>
<field custom-converter="xyz.MyFancyCustomConverter" custom-converter-param="hello">
<a>this</a>
<b key="my.key">this</b>
</field>
</mapping>
But I get this Exception:
org.dozer.MappingException: java.lang.InstantiationException: xyz.MyFancyCustomConverter
Any idea what I'm doing wrong? I guess it's because MyFancyCustomConverter doesn't have a default converter. But I can't add one, because DozerConverter doesn't have one...