Class ConverterUtil

java.lang.Object
hu.rts.mike.example.dev.crm.model.converter.ConverterUtil

public class ConverterUtil extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 page
      R - Type of the content of the result page
      Parameters:
      page - Original Paginated result
      converter - 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 page
      R - Type of the content of the result page
      Parameters:
      page - Original Paginated result
      mapper - Model mapper used to map the object
      destClass - Destination class type of the mapping
      Returns:
      Converted paginated content.