@Target(value=TYPE) @Retention(value=CLASS) public @interface MapperConfig
Generally, any settings given via Mapper
take precedence over the settings given via the referenced
MapperConfig
. The lists of referenced mappers given via Mapper.uses()
and
uses()
will be merged.
Additionally, mapper configuration classes may declare one more prototype mapping methods. These methods are
not meant to be invoked themselves (no implementation will generated for mapper config classes), but serve as
configuration template for mapping methods declared by actual mapper classes. Depending on the configured
mappingInheritanceStrategy()
, the configuration can be inherited either explicitly using
InheritConfiguration
or InheritInverseConfiguration
, or automatically in case all source and target
types are assignable.
Mapper.config()
Modifier and Type | Optional Element and Description |
---|---|
CollectionMappingStrategy |
collectionMappingStrategy
The strategy to be applied when propagating the value of collection-typed properties.
|
String |
componentModel
Specifies the component model to which the generated mapper should
adhere.
|
String |
implementationName
Specifies the name of the implementation class.
|
String |
implementationPackage
Specifies the target package for the generated implementation.
|
MappingInheritanceStrategy |
mappingInheritanceStrategy
The strategy to use for applying method-level configuration annotations of prototype methods in the interface
annotated with this annotation.
|
NullValueCheckStrategy |
nullValueCheckStrategy
Determines when to include a null check on the source property value of a bean mapping.
|
NullValueMappingStrategy |
nullValueMappingStrategy
The strategy to be applied when
null is passed as source value to mapping methods. |
ReportingPolicy |
unmappedTargetPolicy
How unmapped properties of the target type of a mapping should be
reported.
|
Class<?>[] |
uses
The mapper types used by this mapper.
|
public abstract Class<?>[] uses
public abstract ReportingPolicy unmappedTargetPolicy
public abstract String componentModel
default
: the mapper uses no component model, instances are
typically retrieved via Mappers.getMapper(Class)
cdi
: the generated mapper is an application-scoped CDI bean and
can be retrieved via @Inject
spring
: the generated mapper is a Spring bean and
can be retrieved via @Autowired
jsr330
: the generated mapper is annotated with @javax.inject.Named
and
@Singleton
, and can be retrieved via @Inject
public abstract String implementationName
<CLASS_NAME>
will be replaced by the
interface/abstract class name.
Defaults to postfixing the name with Impl
: <CLASS_NAME>Impl
implementationPackage()
public abstract String implementationPackage
<PACKAGE_NAME>
will be replaced by the
interface's or abstract class' package.
Defaults to using the same package as the mapper interface/abstract class
implementationName()
public abstract CollectionMappingStrategy collectionMappingStrategy
orderDto.addOrderLine()
).public abstract NullValueMappingStrategy nullValueMappingStrategy
null
is passed as source value to mapping methods. If no strategy is
configured, NullValueMappingStrategy.RETURN_NULL
will be used by default.null
is passed as source value to mapping methods.public abstract MappingInheritanceStrategy mappingInheritanceStrategy
Mapping
,
IterableMapping
, MapMapping
, or BeanMapping
.
If no strategy is configured, MappingInheritanceStrategy.EXPLICIT
will be used as default.
@Mapping
configurations of prototype methods in the interface
annotated with this annotation.public abstract NullValueCheckStrategy nullValueCheckStrategy
Mapper
or Mapping
.Copyright © 2012-2016 Gunnar Morling; All rights reserved. Released under the Apache Software License 2.0.