public final class FeatherflyDozerBeanMapperBuilder
extends java.lang.Object
Mapper. Provides fluent interface to configure
every aspect of the mapper. Everything which is not explicitly specified will
receive its default value. Please refer to class methods for possible
configuration options.| 限定符和类型 | 方法和说明 |
|---|---|
com.github.dozermapper.core.Mapper |
build()
Creates an instance of
Mapper. |
static com.github.dozermapper.core.Mapper |
buildDefault()
Creates an instance of
Mapper, with all the configuration set to
its default values. |
static FeatherflyDozerBeanMapperBuilder |
create()
Creates new builder.
|
FeatherflyDozerBeanMapperBuilder |
withBeanFactory(java.lang.String factoryName,
com.github.dozermapper.core.BeanFactory beanFactory)
Registers a
BeanFactory for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withBeanFactorys(java.util.Map<java.lang.String,com.github.dozermapper.core.BeanFactory> beanFactories)
Registers a
BeanFactory for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withBeanMappingsBuilders(com.github.dozermapper.core.builder.BeanMappingsBuilder... beanMappingsBuilder)
Registers a
BeanMappingsBuilder for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withBeanMappingsBuilders(com.github.dozermapper.core.builder.BeanMappingsBuilder beanMappingsBuilder)
Registers a
BeanMappingsBuilder for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withBeanMappingsBuilders(java.util.List<com.github.dozermapper.core.builder.BeanMappingsBuilder> beanMappingsBuilder)
Registers a
BeanMappingsBuilder for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withCacheManager(com.github.dozermapper.core.cache.CacheManager cacheManager)
Registers a
CacheManager for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withClassLoader(java.lang.ClassLoader classLoader)
Sets classloader to be used whenever Dozer needs to load a class or
resource.
|
FeatherflyDozerBeanMapperBuilder |
withClassLoader(com.github.dozermapper.core.util.DozerClassLoader classLoader)
Sets
DozerClassLoader to be used whenever Dozer needs to load a
class or resource. |
FeatherflyDozerBeanMapperBuilder |
withCustomConverter(com.github.dozermapper.core.CustomConverter customConverter)
Registers a
CustomConverter for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withCustomConverters(com.github.dozermapper.core.CustomConverter... customConverters)
Registers a
CustomConverter for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withCustomConverters(java.util.List<com.github.dozermapper.core.CustomConverter> customConverters)
Registers a
CustomConverter for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withCustomConvertersWithIds(java.util.Map<java.lang.String,com.github.dozermapper.core.CustomConverter> customConvertersWithId)
Registers a
CustomConverter which can be referenced in mapping by
provided ID. |
FeatherflyDozerBeanMapperBuilder |
withCustomConverterWithId(java.lang.String converterId,
com.github.dozermapper.core.CustomConverter converter)
Registers a
CustomConverter which can be referenced in mapping by
provided ID. |
FeatherflyDozerBeanMapperBuilder |
withCustomFieldMapper(com.github.dozermapper.core.CustomFieldMapper customFieldMapper)
Registers a
CustomFieldMapper for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withElementReader(com.github.dozermapper.core.loader.xml.ElementReader elementReader)
Registers a
ElementReader for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withELEngine(com.github.dozermapper.core.el.ELEngine elEngine)
Registers a
ELEngine for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withEventListener(com.github.dozermapper.core.events.EventListener eventListener)
Registers a
EventListener for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withEventListeners(com.github.dozermapper.core.events.EventListener... eventListeners)
Registers a
EventListener for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withEventListeners(java.util.List<com.github.dozermapper.core.events.EventListener> eventListeners)
Registers a
EventListener for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withMapEmptyString(boolean isMapEmptyString) |
FeatherflyDozerBeanMapperBuilder |
withMapNull(boolean isMapNull) |
FeatherflyDozerBeanMapperBuilder |
withMappingBuilder(com.github.dozermapper.core.loader.api.BeanMappingBuilder mappingBuilder)
Registers a
BeanMappingBuilder for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withMappingBuilders(com.github.dozermapper.core.loader.api.BeanMappingBuilder... mappingBuilders)
Registers a
BeanMappingBuilder for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withMappingBuilders(java.util.List<com.github.dozermapper.core.loader.api.BeanMappingBuilder> mappingBuilders)
Registers a
BeanMappingBuilder for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withMappingFiles(java.util.List<java.lang.String> mappingFiles)
Adds
mappingFiles to the list of URLs to be used as mapping
configuration. |
FeatherflyDozerBeanMapperBuilder |
withMappingFiles(java.lang.String... mappingFiles)
Adds
mappingFiles to the list of URLs to be used as mapping
configuration. |
FeatherflyDozerBeanMapperBuilder |
withSettingsProcessor(com.github.dozermapper.core.config.processors.SettingsProcessor processor)
Registers a
SettingsProcessor for the mapper. |
FeatherflyDozerBeanMapperBuilder |
withXmlMapping(java.util.function.Supplier<java.io.InputStream> xmlMappingSupplier)
Registers a supplier of
InputStream which is expected to contain
data of XML mapping file. |
public FeatherflyDozerBeanMapperBuilder withMapNull(boolean isMapNull)
public FeatherflyDozerBeanMapperBuilder withMapEmptyString(boolean isMapEmptyString)
public static FeatherflyDozerBeanMapperBuilder create()
public static com.github.dozermapper.core.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 FeatherflyDozerBeanMapperBuilder withMappingFiles(java.lang.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 FeatherflyDozerBeanMapperBuilder withMappingFiles(java.util.List<java.lang.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 FeatherflyDozerBeanMapperBuilder withClassLoader(com.github.dozermapper.core.util.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
FeatherflyDozerBeanMapperBuilder will be used (wrapped into
DefaultClassLoader).
classLoader - custom classloader to be used by Dozer.public FeatherflyDozerBeanMapperBuilder withClassLoader(java.lang.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
FeatherflyDozerBeanMapperBuilder will be used (wrapped into
DefaultClassLoader).
classLoader - custom classloader to be used by Dozer. Will be
wrapped into DefaultClassLoader.public FeatherflyDozerBeanMapperBuilder withCustomConverter(com.github.dozermapper.core.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 FeatherflyDozerBeanMapperBuilder withCustomConverters(com.github.dozermapper.core.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 FeatherflyDozerBeanMapperBuilder withCustomConverters(java.util.List<com.github.dozermapper.core.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 FeatherflyDozerBeanMapperBuilder withXmlMapping(java.util.function.Supplier<java.io.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 FeatherflyDozerBeanMapperBuilder withMappingBuilder(com.github.dozermapper.core.loader.api.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 FeatherflyDozerBeanMapperBuilder withMappingBuilders(com.github.dozermapper.core.loader.api.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 FeatherflyDozerBeanMapperBuilder withMappingBuilders(java.util.List<com.github.dozermapper.core.loader.api.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 FeatherflyDozerBeanMapperBuilder withBeanMappingsBuilders(com.github.dozermapper.core.builder.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 FeatherflyDozerBeanMapperBuilder withBeanMappingsBuilders(com.github.dozermapper.core.builder.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 FeatherflyDozerBeanMapperBuilder withBeanMappingsBuilders(java.util.List<com.github.dozermapper.core.builder.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 FeatherflyDozerBeanMapperBuilder withEventListener(com.github.dozermapper.core.events.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 FeatherflyDozerBeanMapperBuilder withEventListeners(com.github.dozermapper.core.events.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 FeatherflyDozerBeanMapperBuilder withEventListeners(java.util.List<com.github.dozermapper.core.events.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 FeatherflyDozerBeanMapperBuilder withCustomFieldMapper(com.github.dozermapper.core.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 FeatherflyDozerBeanMapperBuilder withCustomConverterWithId(java.lang.String converterId, com.github.dozermapper.core.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 FeatherflyDozerBeanMapperBuilder withCustomConvertersWithIds(java.util.Map<java.lang.String,com.github.dozermapper.core.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 FeatherflyDozerBeanMapperBuilder withBeanFactory(java.lang.String factoryName, com.github.dozermapper.core.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 FeatherflyDozerBeanMapperBuilder withBeanFactorys(java.util.Map<java.lang.String,com.github.dozermapper.core.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 FeatherflyDozerBeanMapperBuilder withSettingsProcessor(com.github.dozermapper.core.config.processors.SettingsProcessor processor)
SettingsProcessor for the mapper. Which can be used
to resolve a settings instance.
By default, DefaultSettingsProcessor is registered.
processor - processor to usepublic FeatherflyDozerBeanMapperBuilder withELEngine(com.github.dozermapper.core.el.ELEngine elEngine)
ELEngine for the mapper. Which can be used to resolve
expressions within the defined mappings.
By default, NoopELEngine is registered, unless
ExpressionFactoryImpl is detected on classpath, then
DefaultELEngine
elEngine - elEngine to usepublic FeatherflyDozerBeanMapperBuilder withElementReader(com.github.dozermapper.core.loader.xml.ElementReader elementReader)
ElementReader for the mapper. Which can be used to
resolve expressions within the defined XML mappings.
By default, SimpleElementReader are registered, unless
ExpressionFactoryImpl is detected on classpath, then
ExpressionElementReader
elementReader - elementReader to usepublic FeatherflyDozerBeanMapperBuilder withCacheManager(com.github.dozermapper.core.cache.CacheManager cacheManager)
CacheManager for the mapper. Which can be used to
control the caching behaviour
By default, DefaultCacheManager are registered
cacheManager - cacheManager to usepublic com.github.dozermapper.core.Mapper build()
Mapper. Mapper is configured according to
the current builder state.
Subsequent calls of this method will return new instances.
Mapper.