Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configure custom converters using Dozer Java API

Tags:

java

dozer


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:

<configuration>
    <custom-converters>
        <converter type="com.abc.A2BConverter" >
            <class-a>com.abc.ClassA</class-a>
            <class-b>com.abc.ClassB</class-b>
      </converter>
    </custom-converters>     
</configuration>`

Any help is appreciated!

like image 958
dchen Avatar asked Apr 05 '12 18:04

dchen


1 Answers

The Dozer documentation says:

In fact some parts of the configuration (e.g. global configuration block) are only possible to express in Xml format. (Link)

As far as I know class-level custom converters have to be defined in this global configuration block.

So: No, you cannot define them via the Java API.

like image 151
Sebi Avatar answered Sep 24 '22 05:09

Sebi