Package io.beanmapper
Class BeanMapper
java.lang.Object
io.beanmapper.BeanMapper
Class that is responsible first for understanding the semantics of the source and target
objects. Once that has been determined, the applicable properties will be copied from
source to target.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<S,
T> Collection<T> map
(Collection<S> collection, Class<T> elementInCollectionClass) Maps the source collection to a new target collection.<S,
T> List<T> Maps the source list of elements to a new target list.<K,
S, T> Map<K, T> Maps the source map of elements to a new target map.<S,
T> Optional<T> Copies the values from the optional source object to a newly constructed target instance<S,
T> Queue<T> Maps the source queue to a new target queue.<S,
T> Set<T> Maps the source set of elements to a new target set.<S,
T> T map
(S source) <S,
T> T[] Maps the source array to an array with the type of the target class.<S,
T> T Copies the values from the source object to a newly constructed target instance<S,
P extends ParameterizedType>
Objectmap
(S source, P target) Maps the source to the given target.<S,
T> T map
(S source, T target) Copies the values from the source object to an existing target instancewrap()
-
Constructor Details
-
BeanMapper
-
-
Method Details
-
map
public <S,T> T map(S source) -
map
public <S,T> T map(S source, T target) Copies the values from the source object to an existing target instance- Type Parameters:
S
- the instance from which the properties get copied.T
- the instance to which the properties get copied- Parameters:
source
- source instance of the propertiestarget
- target instance for the properties- Returns:
- the original target instance containing all applicable properties
-
map
Copies the values from the optional source object to a newly constructed target instance- Type Parameters:
S
- the instance from which the properties get copiedT
- the instance to which the properties get copied- Parameters:
source
- optional source instance of the propertiestargetClass
- class of the target, needs to be constructed as the target instance- Returns:
- the optional target instance containing all applicable properties
-
map
Maps the source to the given target.If the target is a Collection, Map, or Optional, the object wrapped in the source, will be mapped to the type corresponding to the relevant type argument.
- Type Parameters:
S
- Type of the source.P
- Type of the specific implementation of ParameterizedType used as the target.- Parameters:
source
- Source instance of the properties.target
- Implementation of ParameterizedType, which provides the information necessary to map elements to the correct type.- Returns:
- The result of the mapping.
-
map
Copies the values from the source object to a newly constructed target instance- Type Parameters:
S
- The instance from which the properties get copiedT
- the instance to which the properties get copied- Parameters:
source
- source instance of the propertiestargetClass
- class of the target, needs to be constructed as the target instance- Returns:
- the target instance containing all applicable properties
-
map
Maps the source array to an array with the type of the target class.- Type Parameters:
S
- The type of the elements in the source array.T
- The type of the elements in the target array.- Parameters:
sourceArray
- The source array.targetClass
- The class to which the elements from the source array will be converted to.- Returns:
- A newly constructed array of the type of the target class.
-
map
Maps the source collection to a new target collection.The type of the target collection is determined automatically from the actual type of the source collection. If the source
- Type Parameters:
S
- The type up the elements in the source collection.T
- The type of the target, to which the source elements will be mapped.- Parameters:
collection
- - The source collectionelementInCollectionClass
- - The class of each element in the target list.- Returns:
- The target collection with mapped source collection elements.
-
map
Maps the source list of elements to a new target list. Convenience operator- Type Parameters:
S
- the class type of the source listT
- the class type of an element in the target list- Parameters:
list
- the source listelementInListClass
- the class of each element in the target list- Returns:
- the target list with mapped source list elements
-
map
Maps the source set of elements to a new target set. Convenience operator- Type Parameters:
S
- the class type of the source setT
- the class type of an element in the target set- Parameters:
set
- the source setelementInSetClass
- the class of each element in the target set- Returns:
- the target set with mapped source set elements
-
map
Maps the source queue to a new target queue. Convenience operator.- Type Parameters:
S
- The class type of the source queue.T
- The class type of the elements in the target queue.- Parameters:
queue
- The source queue.elementInQueueClass
- The class of each element in the target queue.- Returns:
- The target queue with mapped source queue elements.
-
map
Maps the source map of elements to a new target map. Convenience operator- Type Parameters:
K
- the class type of a key in both source and target mapT
- the class type of a value in the target mapS
- the class type of the source map- Parameters:
map
- the source mapmapValueClass
- the class of each value in the target map- Returns:
- the target map with literal source set keys and mapped source set values
-
wrap
-
getConfiguration
-