use of org.dozer.loader.api.BeanMappingBuilder in project camel by apache.
the class DozerTypeConverterDTOTest method setUp.
@Override
public void setUp() throws Exception {
super.setUp();
DozerBeanMapper mapper = createCleanMapper();
DozerTypeConverterLoader loader = new DozerTypeConverterLoader(context, mapper);
loader.addMapping(new BeanMappingBuilder() {
@Override
protected void configure() {
mapping(CustomerDTO.class, Customer.class);
}
});
}
use of org.dozer.loader.api.BeanMappingBuilder in project useful-java-links by Vedenin.
the class DozerHelloWorldApi method main.
public static void main(String[] args) {
// init mapper
BeanMappingBuilder builder = new BeanMappingBuilder() {
protected void configure() {
mapping(Source.class, Destination.class).fields("message", "text");
}
};
DozerBeanMapper mapper = new DozerBeanMapper();
mapper.addMapping(builder);
// convert
Source source = new Source("Hello World!");
Destination destObject = mapper.map(source, Destination.class);
// print Hello World!
destObject.print();
}
Aggregations