Fork me on GitHub

Expression Language

Usage

Dozer provides optional support for standard java expression language (javax.el).

Current support for expressions is start-up time only. Expressions are not resolved during each mapping, but rather during Xml mapping file loading procedure. Each attribute or node value can contain a valid EL expression ${}.

Dozer supports any EL implementation written against javax.el standard API. Functionality is tested with JUEL internally, but other EL providers should be working as well.

You can define global variables for the mapper in variables configuration block.

        
    <configuration>
        <wildcard>true</wildcard>
        <variables>
            <variable name="type_name">org.dozer.sample.MyType
            </variable>
        </variables>
        <mapping>
            <class-a>${type_name}</class-a>
        ...
    </configuration>            

Enabling

EL support is an optional feature. If it is not enable it does not affect mapping performance neither it requires additional Jar dependencies to your project.

In order to enable EL expression execution dozer.el.enabled parameter should be set to true.