Class ConverterUtil
java.lang.Object
hu.rts.mike.example.dev.crm.model.converter.ConverterUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,R> org.springframework.data.domain.Page<R> convertPage(org.springframework.data.domain.Page<T> page, Function<T, R> converter) Helper function to convert Paged results using a converter function.static <T,R> org.springframework.data.domain.Page<R> convertPage(org.springframework.data.domain.Page<T> page, org.modelmapper.ModelMapper mapper, Class<R> destClass) Helper function to convert Paged results using a converter function.
-
Constructor Details
-
ConverterUtil
public ConverterUtil()
-
-
Method Details
-
convertPage
public static <T,R> org.springframework.data.domain.Page<R> convertPage(org.springframework.data.domain.Page<T> page, Function<T, R> converter) Helper function to convert Paged results using a converter function.- Type Parameters:
T- Type of the content of the original pageR- Type of the content of the result page- Parameters:
page- Original Paginated resultconverter- Converter function which usually converts an entity to a DTO.- Returns:
- Converted paginated content.
-
convertPage
public static <T,R> org.springframework.data.domain.Page<R> convertPage(org.springframework.data.domain.Page<T> page, org.modelmapper.ModelMapper mapper, Class<R> destClass) Helper function to convert Paged results using a converter function.- Type Parameters:
T- Type of the content of the original pageR- Type of the content of the result page- Parameters:
page- Original Paginated resultmapper- Model mapper used to map the objectdestClass- Destination class type of the mapping- Returns:
- Converted paginated content.
-