public interface BeanMapper
Modifier and Type | Method and Description |
---|---|
<T> T |
map(Object source,
Class<T> targetClass)
|
<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> |
mapTypesafe(Class<API> apiClass,
S source,
Class<T> targetClass)
A type-safe variant of
map(Object, Class) to prevent accidental abuse (e.g. |
<T> T map(Object source, Class<T> targetClass)
T
- is the generic type to convert to.source
- is the object to convert.targetClass
- is the Class
reflecting the type to convert to.null
if source
is null
.<API,S extends API,T extends API> T mapTypesafe(Class<API> apiClass, S source, Class<T> targetClass)
map(Object, Class)
to prevent accidental abuse (e.g. mapping of apples to bananas).API
- is a common super-type (interface) of source
and targetType
.S
- is the generic type of source
.T
- is the generic type to convert to (target).apiClass
- is the Class
reflecting the <API>.source
- is the object to convert.targetClass
- is the Class
reflecting the type to convert to.null
if source
is null
.<T> List<T> mapList(List<?> source, Class<T> targetClass)
List
with the mapped bean
for each entry
of
the given List
. Uses false
for suppressNullValues
(see
mapList(List, Class, boolean)
).<T> List<T> mapList(List<?> source, Class<T> targetClass, boolean suppressNullValues)
T
- is the generic type to convert the List
entries to.source
- is the List
with the source objects.targetClass
- is the Class
reflecting the type to convert each List
entry to.suppressNullValues
- true
if null
values shall be suppressed/omitted in the
resulting List
, false
otherwise.List
with the converted objects. Will be empty
is source
is
empty or null
.<T> Set<T> mapSet(Set<?> source, Class<T> targetClass)
Set
with the mapped bean
for each entry
of the given Set
. Uses false
for suppressNullValues
(see
mapSet(Set, Class, boolean)
).<T> Set<T> mapSet(Set<?> source, Class<T> targetClass, boolean suppressNullValues)
T
- is the generic type to convert the Set
entries to.source
- is the Set
with the source objects.targetClass
- is the Class
reflecting the type to convert each Set
entry to.suppressNullValues
- true
if null
values shall be suppressed/omitted in the
resulting Set
, false
otherwise.Set
with the converted objects. Will be empty
is source
is
empty or null
.Copyright © 2014–2016 OASP-Team. All rights reserved.