Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Class
Mapper
Provides functionality for mapping. UsesMappingProfileProvider
to perform mappingTypeA
toTypeB
declared in one of theMappingProfiles
mappings lists.Class
MappingProfileProvider
serves as a bridge betweenMapper
andMappingProfile
. Ensures the uniqueness of the declaration for typed mapping functions. Also allows the mapping function to use nested mapping functions declared in othersMappingProfile
.Abstract class
MappingProfile
contains a list of mappings functions.The following example shows how to declare mapping
Type Long
toType String.
We may later use it for nested mappings.
How to use.
Method of delivery
MappingProfile
toMapper
сan be any, depending on the user's implementation.Koin way:
You must call
registerMapper()
in any of your koin modules. After you can declareMappingProfile
in any of your modules:After inject
Mapper
to whatever you want using koinget()
orinject()
functions.Dagger 2 way:
You must declare
MappingProfile
at your dagger module:After declare
Mapper
andMappingProfileProvider
No DI way(not recommended but one of possible):
You can manually delivery
MappingProfileProvider
toMapper
Also you can add
MappingProfile
to already registeredMappingProfileProvider
byaddProfile(profile: MappingProfile)
function.