public static DozerBeanMapperBuilder create()
public static Mapper buildDefault()
Mapper, with all the configuration set to its default values.
The only special handling is for mapping file. If there is a file with name dozerBeanMapping.xml
available on classpath, this file will be used by created mapper. Otherwise the mapper is implicit.
Mapper with default configuration and optionally initiated mapping file.public DozerBeanMapperBuilder withMappingFiles(String... mappingFiles)
mappingFiles to the list of URLs to be used as mapping configuration. It is possible to load files from
file system via file: prefix. If no prefix is given, loaded from classpath.
Multiple calls of this method will result in all the files being added to the list of mappings in the order methods were called.
If not called, no files will be added to the mapping configuration, and mapper will use implicit mode.
mappingFiles - URLs to mapping files to be added.public DozerBeanMapperBuilder withMappingFiles(List<String> mappingFiles)
mappingFiles to the list of URLs to be used as mapping configuration. It is possible to load files from
file system via file: prefix. If no prefix is given, loaded from classpath.
Multiple calls of this method will result in all the files being added to the list of mappings in the order methods were called.
If not called, no files will be added to the mapping configuration, and mapper will use implicit mode.
mappingFiles - URLs to mapping files to be added.public DozerBeanMapperBuilder withClassLoader(DozerClassLoader classLoader)
DozerClassLoader to be used whenever Dozer needs to load a class or resource.
By default, if Dozer is executed in OSGi environment, OSGiClassLoader will be
used (i.e. delegate loading to Dozer bundle classloader). If Dozer is executed in non-OSGi environment,
classloader of DozerBeanMapperBuilder will be used (wrapped into DefaultClassLoader).
classLoader - custom classloader to be used by Dozer.public DozerBeanMapperBuilder withClassLoader(ClassLoader classLoader)
By default, if Dozer is executed in OSGi environment, OSGiClassLoader will be
used (i.e. delegate loading to Dozer bundle classloader). If Dozer is executed in non-OSGi environment,
classloader of DozerBeanMapperBuilder will be used (wrapped into DefaultClassLoader).
classLoader - custom classloader to be used by Dozer. Will be wrapped into DefaultClassLoader.public DozerBeanMapperBuilder withCustomConverter(CustomConverter customConverter)
CustomConverter for the mapper. Multiple calls of this method will register converters in the order of calling.
By default, no custom converters are used by generated mapper.
customConverter - converter to be registered.public DozerBeanMapperBuilder withCustomConverters(CustomConverter... customConverters)
CustomConverter for the mapper. Multiple calls of this method will register converters in the order of calling.
By default, no custom converters are used by generated mapper.
customConverters - converters to be registered.public DozerBeanMapperBuilder withCustomConverters(List<CustomConverter> customConverters)
CustomConverter for the mapper. Multiple calls of this method will register converters in the order of calling.
By default, no custom converters are used by generated mapper.
customConverters - converters to be registered.public DozerBeanMapperBuilder withXmlMapping(Supplier<InputStream> xmlMappingSupplier)
InputStream which is expected to contain data of XML mapping file.
At the moment of create() method call, suppliers will be called in the order they were registered,
the data of each stream will be read and processed, stream will be immediately closed.
Please note, XML mappings are processed before fluent builder mappings. Although it is not recommended to mix the approaches.
By default, no XML mappings are registered.
xmlMappingSupplier - supplier of a Dozer mapping XML InputStream.public DozerBeanMapperBuilder withMappingBuilder(BeanMappingBuilder mappingBuilder)
BeanMappingBuilder for the mapper. Multiple calls of this method will register builders in the order of calling.
Builders are executed at the moment of create() method call.
Please note, XML mappings are processed before Java builder mappings. Although it is not recommended to mix the approaches.
By default, no API builders are registered.
mappingBuilder - mapping builder to be registered for the mapper.public DozerBeanMapperBuilder withMappingBuilders(BeanMappingBuilder... mappingBuilders)
BeanMappingBuilder for the mapper. Multiple calls of this method will register builders in the order of calling.
Builders are executed at the moment of create() method call.
Please note, XML mappings are processed before Java builder mappings. Although it is not recommended to mix the approaches.
By default, no API builders are registered.
mappingBuilders - mapping builder to be registered for the mapper.public DozerBeanMapperBuilder withMappingBuilders(List<BeanMappingBuilder> mappingBuilders)
BeanMappingBuilder for the mapper. Multiple calls of this method will register builders in the order of calling.
Builders are executed at the moment of create() method call.
Please note, XML mappings are processed before Java builder mappings. Although it is not recommended to mix the approaches.
By default, no API builders are registered.
mappingBuilders - mapping builder to be registered for the mapper.public DozerBeanMapperBuilder withBeanMappingsBuilders(BeanMappingsBuilder beanMappingsBuilder)
BeanMappingsBuilder for the mapper. Multiple calls of this method will register builders in the order of calling.
Builders are executed at the moment of create() method call.
Current implementations include; BeanMappingXMLBuilder
By default, no API builders are registered.
beanMappingsBuilder - mapping builder to be registered for the mapper.public DozerBeanMapperBuilder withBeanMappingsBuilders(BeanMappingsBuilder... beanMappingsBuilder)
BeanMappingsBuilder for the mapper. Multiple calls of this method will register builders in the order of calling.
Builders are executed at the moment of create() method call.
Current implementations include; BeanMappingXMLBuilder
By default, no API builders are registered.
beanMappingsBuilder - mapping builder to be registered for the mapper.public DozerBeanMapperBuilder withBeanMappingsBuilders(List<BeanMappingsBuilder> beanMappingsBuilder)
BeanMappingsBuilder for the mapper. Multiple calls of this method will register builders in the order of calling.
Builders are executed at the moment of create() method call.
Current implementations include; BeanMappingXMLBuilder
By default, no API builders are registered.
beanMappingsBuilder - mapping builder to be registered for the mapper.public DozerBeanMapperBuilder withEventListener(EventListener eventListener)
EventListener for the mapper. Multiple calls of this method will register listeners in the order of calling.
By default, no listeners are registered.
eventListener - listener to be registered for the mapper.public DozerBeanMapperBuilder withEventListeners(EventListener... eventListeners)
EventListener for the mapper. Multiple calls of this method will register listeners in the order of calling.
By default, no listeners are registered.
eventListeners - listeners to be registered for the mapper.public DozerBeanMapperBuilder withEventListeners(List<EventListener> eventListeners)
EventListener for the mapper. Multiple calls of this method will register listeners in the order of calling.
By default, no listeners are registered.
eventListeners - listeners to be registered for the mapper.public DozerBeanMapperBuilder withCustomFieldMapper(CustomFieldMapper customFieldMapper)
CustomFieldMapper for the mapper. Mapper has only one custom field mapper,
and thus consecutive calls of this method will override previously specified value.
By default, no custom field mapper is registered.
customFieldMapper - custom field mapper to be registered for the mapper.public DozerBeanMapperBuilder withCustomConverterWithId(String converterId, CustomConverter converter)
CustomConverter which can be referenced in mapping by provided ID.
Consecutive calls of this method with the same ID will override previously provided value.
Converter instances provided this way are considered stateful and will not be initialized for each mapping.
By default, no converters with IDs are registered.
converterId - unique ID of the converter, used as reference in mappings.converter - converter to be used for provided ID.public DozerBeanMapperBuilder withCustomConvertersWithIds(Map<String,CustomConverter> customConvertersWithId)
CustomConverter which can be referenced in mapping by provided ID.
Consecutive calls of this method with the same ID will override previously provided value.
Converter instances provided this way are considered stateful and will not be initialized for each mapping.
By default, no converters with IDs are registered.
customConvertersWithId - converters to be used by mapper.public DozerBeanMapperBuilder withBeanFactory(String factoryName, BeanFactory beanFactory)
BeanFactory for the mapper.
Consecutive calls of this method with the same factory name will override previously provided value.
By default, no custom bean factories are registered.
factoryName - unique name of the factory.beanFactory - factory to be used by mapper.public DozerBeanMapperBuilder withBeanFactorys(Map<String,BeanFactory> beanFactories)
BeanFactory for the mapper.
Consecutive calls of this method with the same factory name will override previously provided value.
By default, no custom bean factories are registered.
beanFactories - factory's to be used by mapper.public DozerBeanMapperBuilder withSettingsProcessor(SettingsProcessor processor)
SettingsProcessor for the mapper. Which can be used to resolve a settings instance.
By default, DefaultSettingsProcessor is registered.
processor - processor to usepublic DozerBeanMapperBuilder withELEngine(ELEngine elEngine)
ELEngine for the mapper.
Which can be used to resolve expressions within the defined mappings.
By default, NoopELEngine is registered,
unless com.sun.el.ExpressionFactoryImpl is detected on classpath, then DefaultELEngine
elEngine - elEngine to usepublic DozerBeanMapperBuilder withElementReader(ElementReader elementReader)
ElementReader for the mapper.
Which can be used to resolve expressions within the defined XML mappings.
By default, SimpleElementReader are registered,
unless com.sun.el.ExpressionFactoryImpl is detected on classpath, then ExpressionElementReader
elementReader - elementReader to usepublic DozerBeanMapperBuilder withCacheManager(CacheManager cacheManager)
CacheManager for the mapper.
Which can be used to control the caching behaviour
By default, DefaultCacheManager are registered
cacheManager - cacheManager to useCopyright © 2005–2021 dozer. All rights reserved.