简体   繁体   中英

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!

The Dozer documentation says:

In fact some parts of the configuration (eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM