Search in sources :

Example 1 with Mapper

use of org.dozer.Mapper in project camel by apache.

the class DozerTypeConverterTest method verifyCustomerMapping.

@Test
public void verifyCustomerMapping() throws Exception {
    Mapper mapper = DozerTestArtifactsFactory.createMapper();
    Customer service = createServiceCustomer();
    org.apache.camel.converter.dozer.model.Customer model = mapper.map(service, org.apache.camel.converter.dozer.model.Customer.class);
    Customer roundTrip = mapper.map(model, Customer.class);
    assertEquals(service, roundTrip);
}
Also used : Mapper(org.dozer.Mapper) DozerTestArtifactsFactory.createMapper(org.apache.camel.converter.dozer.DozerTestArtifactsFactory.createMapper) DozerTestArtifactsFactory.createServiceCustomer(org.apache.camel.converter.dozer.DozerTestArtifactsFactory.createServiceCustomer) Customer(org.apache.camel.converter.dozer.service.Customer) Test(org.junit.Test)

Example 2 with Mapper

use of org.dozer.Mapper in project useful-java-links by Vedenin.

the class DozerHelloWorldAnnotation method main.

public static void main(String[] args) {
    // init mapper
    Mapper mapper = new DozerBeanMapper();
    // convert
    Source source = new Source("Hello World!");
    Destination destObject = mapper.map(source, Destination.class);
    // print Hello World!
    destObject.print();
}
Also used : Mapper(org.dozer.Mapper) DozerBeanMapper(org.dozer.DozerBeanMapper) DozerBeanMapper(org.dozer.DozerBeanMapper)

Aggregations

Mapper (org.dozer.Mapper)2 DozerTestArtifactsFactory.createMapper (org.apache.camel.converter.dozer.DozerTestArtifactsFactory.createMapper)1 DozerTestArtifactsFactory.createServiceCustomer (org.apache.camel.converter.dozer.DozerTestArtifactsFactory.createServiceCustomer)1 Customer (org.apache.camel.converter.dozer.service.Customer)1 DozerBeanMapper (org.dozer.DozerBeanMapper)1 Test (org.junit.Test)1