Created
May 16, 2018 09:55
-
-
Save cesarferreira/12ac9f9d7fcd945d9590c8f83837fa20 to your computer and use it in GitHub Desktop.
BaseMapperToDomain
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public abstract class BaseMapperToDomain<SOURCE, TARGET> { | |
| /** | |
| * Transforms a type into another | |
| * | |
| * @param toBeTransformed source that will be transformed | |
| * @return the transformed object | |
| */ | |
| public abstract TARGET mapToDomain(SOURCE toBeTransformed); | |
| /** | |
| * Transforms a list of types into another type | |
| * | |
| * @param list list of sources that will be transformed | |
| * @return the list of transformed objects | |
| */ | |
| public List<TARGET> mapToDomain(List<SOURCE> list) { | |
| List<TARGET> targetList = new ArrayList<>(); | |
| for (SOURCE source : list) { | |
| targetList.add(mapToDomain(source)); | |
| } | |
| return targetList; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment