Package io.github.astrapi69.model.mapper
Interface GenericModelMapper<ENTITY,DTO>
-
- Type Parameters:
ENTITY
- the element type of the entity objectDTO
- 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>
- All Known Implementing Classes:
AbstractGenericMapper
public interface GenericModelMapper<ENTITY,DTO> extends io.github.astrapi69.bean.mapper.GenericMapper<ENTITY,DTO>
The InterfaceGenericModelMapper
provides the methods for mapping entities to data transfer objects and back.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.lang.Class<DTO>
getDtoClass()
Gets the data transfer object class.java.lang.Class<ENTITY>
getEntityClass()
Gets the entity class.org.modelmapper.ModelMapper
getMapper()
Gets the mapper.default <D,S>
java.util.List<D>map(@NonNull java.util.Collection<S> sources, @NonNull java.lang.Class<D> destinationClass)
Constructs new instances of destinationClass and performs mapping between from source.default <D,S>
Dmap(S source, @NonNull java.lang.Class<D> destinationClass)
Constructs new instance of destinationClass and performs mapping between from source.default DTO
toDto(ENTITY entity)
default java.util.List<DTO>
toDtos(@NonNull java.lang.Iterable<ENTITY> entities)
default java.util.List<DTO>
toDtos(@NonNull java.util.Collection<ENTITY> entities)
default java.util.List<ENTITY>
toEntities(@NonNull java.lang.Iterable<DTO> dtos)
default java.util.List<ENTITY>
toEntities(@NonNull java.util.Collection<DTO> dtos)
default ENTITY
toEntity(DTO dto)
-
-
-
Method Detail
-
getDtoClass
java.lang.Class<DTO> getDtoClass()
Gets the data transfer object class.- Returns:
- the data transfer object class
-
getEntityClass
java.lang.Class<ENTITY> getEntityClass()
Gets the entity class.- Returns:
- the entity class
-
getMapper
org.modelmapper.ModelMapper getMapper()
Gets the mapper.- Returns:
- the mapper
-
map
default <D,S> java.util.List<D> map(@NonNull @NonNull java.util.Collection<S> sources, @NonNull @NonNull java.lang.Class<D> destinationClass)
Constructs new instances of destinationClass and performs mapping between from source.- Specified by:
map
in interfaceio.github.astrapi69.bean.mapper.GenericMapper<ENTITY,DTO>
- Type Parameters:
S
- the generic type of the sourceD
- the generic type of the destinationClass- Parameters:
sources
- the collection of source objectsdestinationClass
- the destination class- Returns:
- the new instance of destinationClass mapped to source object.
-
map
default <D,S> D map(@NonNull S source, @NonNull @NonNull java.lang.Class<D> destinationClass)
Constructs new instance of destinationClass and performs mapping between from source.- Specified by:
map
in interfaceio.github.astrapi69.bean.mapper.GenericMapper<ENTITY,DTO>
- Type Parameters:
D
- the generic type of the destinationClassS
- the generic type of the source- Parameters:
source
- the sourcedestinationClass
- the destination class- Returns:
- the new instance of destinationClass mapped to source object.
-
toEntities
default java.util.List<ENTITY> toEntities(@NonNull @NonNull java.util.Collection<DTO> dtos)
-
toEntities
default java.util.List<ENTITY> toEntities(@NonNull @NonNull java.lang.Iterable<DTO> dtos)
-
-