Class AbstractBeanMapper
- java.lang.Object
-
- com.devonfw.module.beanmapping.common.base.AbstractBeanMapper
-
- All Implemented Interfaces:
BeanMapper
- Direct Known Subclasses:
BeanMapperImplDozer,BeanMapperImplOrika
public abstract class AbstractBeanMapper extends Object implements BeanMapper
The abstract base implementation ofBeanMapper.
-
-
Constructor Summary
Constructors Constructor Description AbstractBeanMapper()The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> List<T>mapList(List<?> source, Class<T> targetClass)<T> List<T>mapList(List<?> source, Class<T> targetClass, boolean suppressNullValues)<T> Set<T>mapSet(Set<?> source, Class<T> targetClass)<T> Set<T>mapSet(Set<?> source, Class<T> targetClass, boolean suppressNullValues)<API,S extends API,T extends API>
TmapTypesafe(Class<API> apiClass, S source, Class<T> targetClass)A type-safe variant ofBeanMapper.map(Object, Class)to prevent accidental abuse (e.g.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.devonfw.module.beanmapping.common.api.BeanMapper
map
-
-
-
-
Method Detail
-
mapTypesafe
public <API,S extends API,T extends API> T mapTypesafe(Class<API> apiClass, S source, Class<T> targetClass)
Description copied from interface:BeanMapperA type-safe variant ofBeanMapper.map(Object, Class)to prevent accidental abuse (e.g. mapping of apples to bananas).- Specified by:
mapTypesafein interfaceBeanMapper- Type Parameters:
API- is a common super-type (interface) ofsourceandtargetType.S- is the generic type ofsource.T- is the generic type to convert to (target).- Parameters:
apiClass- is theClassreflecting the <API>.source- is the object to convert.targetClass- is theClassreflecting the type to convert to.- Returns:
- the converted object. Will be
nullifsourceisnull.
-
mapList
public <T> List<T> mapList(List<?> source, Class<T> targetClass)
Description copied from interface:BeanMapperCreates a newListwith themapped beanfor eachentryof the givenList. UsesfalseforsuppressNullValues(seeBeanMapper.mapList(List, Class, boolean)).- Specified by:
mapListin interfaceBeanMapper- Type Parameters:
T- is the generic type to convert theListentries to.- Parameters:
source- is theListwith the source objects.targetClass- is theClassreflecting the type to convert eachListentry to.- Returns:
- the
Listwith the converted objects. Will beemptyissourceis empty ornull.
-
mapList
public <T> List<T> mapList(List<?> source, Class<T> targetClass, boolean suppressNullValues)
Description copied from interface:BeanMapper- Specified by:
mapListin interfaceBeanMapper- Type Parameters:
T- is the generic type to convert theListentries to.- Parameters:
source- is theListwith the source objects.targetClass- is theClassreflecting the type to convert eachListentry to.suppressNullValues-trueifnullvalues shall be suppressed/omitted in the resultingList,falseotherwise.- Returns:
- the
Listwith the converted objects. Will beemptyissourceis empty ornull.
-
mapSet
public <T> Set<T> mapSet(Set<?> source, Class<T> targetClass)
Description copied from interface:BeanMapperCreates a newSetwith themapped beanfor eachentryof the givenSet. UsesfalseforsuppressNullValues(seeBeanMapper.mapSet(Set, Class, boolean)).- Specified by:
mapSetin interfaceBeanMapper- Type Parameters:
T- is the generic type to convert theSetentries to.- Parameters:
source- is theSetwith the source objects.targetClass- is theClassreflecting the type to convert eachSetentry to.- Returns:
- the
Setwith the converted objects. Will beemptyissourceis empty ornull.
-
mapSet
public <T> Set<T> mapSet(Set<?> source, Class<T> targetClass, boolean suppressNullValues)
Description copied from interface:BeanMapper- Specified by:
mapSetin interfaceBeanMapper- Type Parameters:
T- is the generic type to convert theSetentries to.- Parameters:
source- is theSetwith the source objects.targetClass- is theClassreflecting the type to convert eachSetentry to.suppressNullValues-trueifnullvalues shall be suppressed/omitted in the resultingSet,falseotherwise.- Returns:
- the
Setwith the converted objects. Will beemptyissourceis empty ornull.
-
-