Search code examples
javadozer

Call custom converter after default in dozer


Does Dozer could call custom converter after default? I want to create something like chain. At first I want to call default converter to make most of convertion work and only after that call custom converter to populate complex fields?

EDIT

by default when I create custom converter I need to override two methods. Each of this method has 2 arguments source object and target object. But when we call convertTo method second argument(target object) equals to null. So may be I need to specify something in mapping file to make dozer process default converter before custom?

Sorry for bad english


Solution

  • After look into source code I understand that this probably imposible. Instead of this dozer library propose using custom-converters at field level like this:

    <mapping wildcard="false" >
            <class-a>package.A</class-a>
            <class-b>package.B</class-b>
            <field>
                <a>id</a>
                <b>id</b>
            </field>
            <field custom-converter="test.AtoBNameFieldCustomConverter">
                <a>name</a>
                <b>name</b>
            </field>
    </mapping>
    

    May be this help someone.