Search code examples
javadozer

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:

<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!


Solution

  • 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.