Home Package Class Method

Examples of DozerBeanMapper


Examples of org.dozer.DozerBeanMapper

     * @param to To type.
     * @param config config.
     */
    protected DozerTransformer(final QName from, final QName to, List<String> configs) {
        super(from, to);
        _dozerBeanMapper = new DozerBeanMapper();
        if (configs != null && !configs.isEmpty()) {
            _dozerBeanMapper.setMappingFiles(configs);
        }
    }
View Full Code Here

Examples of org.dozer.DozerBeanMapper

        // must set class loader before we create bean mapper
        CamelToDozerClassResolverAdapter adapter = new CamelToDozerClassResolverAdapter(camelContext);
        BeanContainer.getInstance().setClassLoader(adapter);

        log.info("Using DozerBeanMapperConfiguration: {}", configuration);
        DozerBeanMapper mapper = createDozerBeanMapper(configuration);

        this.camelContext = camelContext;
        this.mapper = mapper;

        try {
View Full Code Here

Examples of org.dozer.DozerBeanMapper

                log.warn("Loaded " + configurations.size() + " Dozer configurations from Camel registry."
                        + " Dozer is most efficient when there is a single mapper instance. Consider amalgamating instances.");
            }
            for (Map.Entry<String, DozerBeanMapperConfiguration> entry : configurations.entrySet()) {
                String id = entry.getKey();
                DozerBeanMapper beanMapper = createDozerBeanMapper(entry.getValue());
                // only add if we do not already have it
                if (!mappers.containsValue(beanMapper)) {
                    mappers.put(id, beanMapper);
                }
            }
        }

        if (mappers.size() > 1) {
            log.warn("Loaded " + mappers.size() + " Dozer mappers from Camel registry."
                    + " Dozer is most efficient when there is a single mapper instance. Consider amalgamating instances.");
        } else if (mappers.size() == 0) {
            log.warn("No Dozer mappers found in Camel registry. You should add Dozer mappers as beans to the registry of the type: "
                    + DozerBeanMapper.class.getName());
        }


        TypeConverterRegistry registry = camelContext.getTypeConverterRegistry();
        for (Map.Entry<String, DozerBeanMapper> entry : mappers.entrySet()) {
            String mapperId = entry.getKey();
            DozerBeanMapper dozer = entry.getValue();
            List<ClassMap> all = loadMappings(camelContext, mapperId, dozer);
            registerClassMaps(registry, mapperId, dozer, all);
        }
    }
View Full Code Here

Examples of org.dozer.DozerBeanMapper

     *
     * @param configuration  the dozer bean mapper configuration.
     * @return the created mapper
     */
    protected DozerBeanMapper createDozerBeanMapper(DozerBeanMapperConfiguration configuration) {
        DozerBeanMapper mapper;
        if (configuration.getMappingFiles() != null) {
            mapper = new DozerBeanMapper(configuration.getMappingFiles());
        } else {
            mapper = new DozerBeanMapper();
        }
        if (configuration.getCustomConverters() != null) {
            mapper.setCustomConverters(configuration.getCustomConverters());
        }
        if (configuration.getEventListeners() != null) {
            mapper.setEventListeners(configuration.getEventListeners());
        }
        if (configuration.getCustomConvertersWithId() != null) {
            mapper.setCustomConvertersWithId(configuration.getCustomConvertersWithId());
        }
        if (configuration.getCustomFieldMapper() != null) {
            mapper.setCustomFieldMapper(configuration.getCustomFieldMapper());
        }
        return mapper;
    }
View Full Code Here

Examples of org.dozer.DozerBeanMapper

@Configuration
public class DozerConfig {

    @Bean
    public DozerBeanMapper getMapper() {
        return new DozerBeanMapper(
                Arrays.asList("dozer-global-configuration.xml", "dozer-mapping.xml")
        );
    }
View Full Code Here

Examples of org.dozer.DozerBeanMapper

        // must set class loader before we create bean mapper
        CamelToDozerClassResolverAdapter adapter = new CamelToDozerClassResolverAdapter(camelContext);
        BeanContainer.getInstance().setClassLoader(adapter);

        log.info("Using DozerBeanMapperConfiguration: {}", configuration);
        DozerBeanMapper mapper = createDozerBeanMapper(configuration);

        init(camelContext, mapper);
    }
View Full Code Here

Examples of org.dozer.DozerBeanMapper

                log.warn("Loaded " + configurations.size() + " Dozer configurations from Camel registry."
                        + " Dozer is most efficient when there is a single mapper instance. Consider amalgamating instances.");
            }
            for (Map.Entry<String, DozerBeanMapperConfiguration> entry : configurations.entrySet()) {
                String id = entry.getKey();
                DozerBeanMapper beanMapper = createDozerBeanMapper(entry.getValue());
                // only add if we do not already have it
                if (!mappers.containsValue(beanMapper)) {
                    mappers.put(id, beanMapper);
                }
            }
        }

        if (mappers.size() > 1) {
            log.warn("Loaded " + mappers.size() + " Dozer mappers from Camel registry."
                    + " Dozer is most efficient when there is a single mapper instance. Consider amalgamating instances.");
        } else if (mappers.size() == 0) {
            log.warn("No Dozer mappers found in Camel registry. You should add Dozer mappers as beans to the registry of the type: "
                    + DozerBeanMapper.class.getName());
        }


        TypeConverterRegistry registry = camelContext.getTypeConverterRegistry();
        for (Map.Entry<String, DozerBeanMapper> entry : mappers.entrySet()) {
            String mapperId = entry.getKey();
            DozerBeanMapper dozer = entry.getValue();
            List<ClassMap> all = loadMappings(camelContext, mapperId, dozer);
            registerClassMaps(registry, mapperId, dozer, all);
        }
    }
View Full Code Here

Examples of org.dozer.DozerBeanMapper

     *
     * @param configuration  the dozer bean mapper configuration.
     * @return the created mapper
     */
    protected DozerBeanMapper createDozerBeanMapper(DozerBeanMapperConfiguration configuration) {
        DozerBeanMapper mapper;
        if (configuration.getMappingFiles() != null) {
            mapper = new DozerBeanMapper(configuration.getMappingFiles());
        } else {
            mapper = new DozerBeanMapper();
        }
        if (configuration.getCustomConverters() != null) {
            mapper.setCustomConverters(configuration.getCustomConverters());
        }
        if (configuration.getEventListeners() != null) {
            mapper.setEventListeners(configuration.getEventListeners());
        }
        if (configuration.getCustomConvertersWithId() != null) {
            mapper.setCustomConvertersWithId(configuration.getCustomConvertersWithId());
        }
        if (configuration.getCustomFieldMapper() != null) {
            mapper.setCustomFieldMapper(configuration.getCustomFieldMapper());
        }
        return mapper;
    }
View Full Code Here

Examples of org.dozer.DozerBeanMapper

    public static CustomerDTO createDtoCustomer() {
        return new CustomerDTO("Bob", "Roberts", new AddressDTO("12345", "1 main st"));
    }

    public static DozerBeanMapper createMapper() {
        return new DozerBeanMapper(Arrays.asList(new String[]{"mapping.xml"}));
    }
View Full Code Here

Examples of org.dozer.DozerBeanMapper

    public static DozerBeanMapper createMapper() {
        return new DozerBeanMapper(Arrays.asList(new String[]{"mapping.xml"}));
    }

    public static DozerBeanMapper createCleanMapper() {
        return new DozerBeanMapper();
    }
View Full Code Here
TOP
Copyright © 2015 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.