Interface GenericModelMapper<ENTITY,​DTO>

  • Type Parameters:
    ENTITY - the element type of the entity object
    DTO - the generic type of the data transfer object
    All Superinterfaces:
    io.github.astrapi69.bean.mapper.BeanMapper<ENTITY,​DTO>, io.github.astrapi69.bean.mapper.GenericMapper<ENTITY,​DTO,​org.modelmapper.ModelMapper>
    All Known Implementing Classes:
    AbstractGenericMapper

    public interface GenericModelMapper<ENTITY,​DTO>
    extends io.github.astrapi69.bean.mapper.GenericMapper<ENTITY,​DTO,​org.modelmapper.ModelMapper>
    The Interface GenericModelMapper provides the methods for mapping entities to data transfer objects and back.
    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default <D,​S>
      java.util.List<D>
      map​(java.util.Collection<S> sources, java.lang.Class<D> destinationClass)
      Constructs new instances of destinationClass and performs mapping between from source.
      default <D,​S>
      D
      map​(S source, java.lang.Class<D> destinationClass)
      Constructs new instance of destinationClass and performs mapping between from source.
      default DTO toDto​(ENTITY entity)
      default ENTITY toEntity​(DTO dto)
      • Methods inherited from interface io.github.astrapi69.bean.mapper.BeanMapper

        toDtos, toDtos, toEntities, toEntities
      • Methods inherited from interface io.github.astrapi69.bean.mapper.GenericMapper

        getDtoClass, getEntityClass, getMapper
    • Method Detail

      • map

        default <D,​S> java.util.List<D> map​(java.util.Collection<S> sources,
                                                  java.lang.Class<D> destinationClass)
        Constructs new instances of destinationClass and performs mapping between from source.
        Specified by:
        map in interface io.github.astrapi69.bean.mapper.GenericMapper<ENTITY,​DTO,​org.modelmapper.ModelMapper>
        Type Parameters:
        S - the generic type of the source
        D - the generic type of the destinationClass
        Parameters:
        sources - the collection of source objects
        destinationClass - the destination class
        Returns:
        the new instance of destinationClass mapped to source object.
      • map

        default <D,​S> D map​(S source,
                                  java.lang.Class<D> destinationClass)
        Constructs new instance of destinationClass and performs mapping between from source.
        Specified by:
        map in interface io.github.astrapi69.bean.mapper.GenericMapper<ENTITY,​DTO,​org.modelmapper.ModelMapper>
        Type Parameters:
        D - the generic type of the destinationClass
        S - the generic type of the source
        Parameters:
        source - the source
        destinationClass - the destination class
        Returns:
        the new instance of destinationClass mapped to source object.
      • toDto

        default DTO toDto​(ENTITY entity)
        Specified by:
        toDto in interface io.github.astrapi69.bean.mapper.BeanMapper<ENTITY,​DTO>
      • toEntity

        default ENTITY toEntity​(DTO dto)
        Specified by:
        toEntity in interface io.github.astrapi69.bean.mapper.BeanMapper<ENTITY,​DTO>