Custom Create Methods

You can configure Dozer to use custom static create methods to create new instances of destination data objects during the mapping process. This can either be set at the field level or class level.

<mapping>
    <class-a create-method="someCreateMethod">
    com.github.dozermapper.core.vo.InsideTestObject
  </class-a>
    <class-b>com.github.dozermapper.core.vo.InsideTestObjectPrime</class-b>
    <field>
        <a>label</a>
        <b>labelPrime</b>
    </field>
</mapping>

Specifying a custom create method at the Field level…​.

<mapping>
    <class-a>com.github.dozermapper.core.vo.TestObject</class-a>
    <class-b>com.github.dozermapper.core.vo.TestObjectPrime</class-b>
    <field>
        <a>createMethodType</a>
        <b create-method="someCreateMethod">createMethodType</b>
    </field>
</mapping>

It is also possible to reference different class with static factory method. This is done by providing fully qualified type name and method name separated by dot.

<b create-method="com.github.dozermapper.core.factory.Factory.create">field</b>

results matching ""

    No results matching ""