- Type Parameters:
SOURCE
- type of the supported sourceTARGET
- type of the supported target
- All Superinterfaces:
Function<SOURCE,
TARGET>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A generic and general approach to mapping two types.
A mapper is unidirectional - from
SOURCE
to TARGET
.-
Method Summary
Modifier and TypeMethodDescriptiondefault TARGET
Map an instance of source type to an instance of target type.Qualifiers of the mapper.default GenericType
<SOURCE> Source type of the mapper.default GenericType
<TARGET> Target type of the mapper.
-
Method Details
-
map
Map an instance of source type to an instance of target type.- Parameters:
source
- object to map- Returns:
- result of the mapping
-
apply
-
sourceType
Source type of the mapper. This does not need to be implemented when registered usingMappersConfig.Builder
addMapper
methods.It MUST be implemented when implementing a service (i.e.
Service.Singleton
).- Returns:
- type of the source this mapper support
-
targetType
Target type of the mapper. This does not need to be implemented when registered usingMappersConfig.Builder
addMapper
methods.It MUST be implemented when implementing a service (i.e.
Service.Singleton
).- Returns:
- type of the target this mapper support
-
qualifiers
Qualifiers of the mapper. This is only used when the mapper is provided asServiceRegistry
service, otherwise qualifiers provided when registering this mapper are used.- Returns:
- qualifiers of this mapper, defaults to empty set
-