You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Dozer

The dozer: component provides the ability to map between Java beans using the Dozer mapping framework.  Camel also supports the ability to trigger Dozer mappings as a type converter.  The primary differences between using a Dozer endpoint and a Dozer converter are:

  • The ability to manage Dozer mapping configuration on a per-endpoint basis vs. global configuration via the converter registry.
  • A Dozer endpoint can be configured to marshal/unmarshal input and output data using Camel data formats to support a single, any-to-any transformation endpoint
  • The Dozer component allows for fine-grained integration and extension of Dozer to support extended functionality (e.g. mapping constants to target fields).

In order to use the Dozer component, Maven users will need to add the following dependency to their pom.xml:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-dozer</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

URI format

dozer:endpointId[?options]

Where endpointId is a name used to uniquely identify the Dozer endpoint configuration. 

An example Dozer endpoint URI:

from("direct:orderInput").
  to("dozer:transformOrder?mappingFile=orderMapping.xml&targetModel=example.XYZOrder").
  to("direct:orderOutput");

Options

Name

Default

Description

mappingFile

dozerBeanMapping.xml

The location of a Dozer configuration file. The file is loaded from the classpath by default, but you can use file:, classpath:, or http: to load the configuration from a specific location.

unmarshalId

none

The id of a dataFormat defined within the Camel Context to use for unmarshalling the mapping input from a non-Java type.

 

marshalId

none

The id of a dataFormat defined within the Camel Context to use for marshalling the mapping output to a non-Java type.

sourceModel

none

Fully-qualified class name for the source type used in the mapping. If specified, the input to the mapping is converted to the specified type before being mapped with Dozer.

targetModel

none

Fully-qualified class name for the target type used in the mapping. This option is required.

 

 

  • No labels