Created
May 16, 2018 09:56
-
-
Save cesarferreira/dd2c7342517877d3d711a22e637e379d to your computer and use it in GitHub Desktop.
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 BaseMapperToPresentation<SOURCE, TARGET> { | |
/** | |
* Transforms a type into another | |
* | |
* @param toBeTransformed source that will be transformed | |
* @return the transformed object | |
*/ | |
public abstract TARGET mapToPresentation(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> mapToPresentation(List<SOURCE> list) { | |
List<TARGET> targetList = new ArrayList<>(); | |
for (SOURCE source : list) { | |
targetList.add(mapToPresentation(source)); | |
} | |
return targetList; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment