ma.glasnost.orika
Interface MapperFacade

All Known Implementing Classes:
ConfigurableMapper, MapperFacadeImpl

public interface MapperFacade

The main runtime interface between a Java application and Orika. This is the central interface abstracting the service of a Java bean mapping.

The main operation of MapperFacade is map() that copy from a deeply structured one object to an other.

MapperFacade manages the state of a mapping operation through MappingContext.
The operation of mapping may include :


Example of code to map an instance of Entity(entity ) to DTO class:
 ...
 DTO newDTO = mapperFacade.map(entity, DTO.class);
 ...
 

Author:
S.M. El Aatifi

Method Summary
<S,D> D
convert(S source, Class<D> destinationClass, String converterId)
           
<S,D> D
convert(S source, Type<S> sourceType, Type<D> destinationType, String converterId)
          Convert the source object into the appropriate destination type
<S,D> D
map(S sourceObject, Class<D> destinationClass)
          Create and return a new instance of type D mapped with the properties of sourceObject.
<S,D> D
map(S sourceObject, Class<D> destinationClass, MappingContext context)
          Create and return a new instance of type D mapped with the properties of sourceObject.
<S,D> void
map(S sourceObject, D destinationObject)
          Maps the properties of sourceObject onto destinationObject.
<S,D> void
map(S sourceObject, D destinationObject, MappingContext context)
          Maps the properties of sourceObject onto destinationObject.
<S,D> void
map(S sourceObject, D destinationObject, Type<S> sourceType, Type<D> destinationType)
          Maps the properties of sourceObject onto destinationObject, using sourceType and destinationType to specify the parameterized types of the source and destination object.
<S,D> void
map(S sourceObject, D destinationObject, Type<S> sourceType, Type<D> destinationType, MappingContext context)
          Maps the properties of sourceObject onto destinationObject, using sourceType and destinationType to specify the parameterized types of the source and destination object.
<S,D> D
map(S sourceObject, Type<S> sourceType, Type<D> destinationType)
           
<S,D> D
map(S sourceObject, Type<S> sourceType, Type<D> destinationType, MappingContext context)
           
<S,D> D[]
mapAsArray(D[] destination, Iterable<S> source, Class<D> destinationClass)
          Maps the source Array into a new Array of typeD.
<S,D> D[]
mapAsArray(D[] destination, Iterable<S> source, Class<D> destinationClass, MappingContext context)
           
<S,D> D[]
mapAsArray(D[] destination, Iterable<S> source, Type<S> sourceType, Type<D> destinationType)
           
<S,D> D[]
mapAsArray(D[] destination, Iterable<S> source, Type<S> sourceType, Type<D> destinationType, MappingContext context)
           
<Sk,Sv,D> D[]
mapAsArray(D[] destination, Map<Sk,Sv> source, Type<? extends Map<Sk,Sv>> sourceType, Type<D> destinationType)
           
<Sk,Sv,D> D[]
mapAsArray(D[] destination, Map<Sk,Sv> source, Type<? extends Map<Sk,Sv>> sourceType, Type<D> destinationType, MappingContext context)
           
<S,D> D[]
mapAsArray(D[] destination, S[] source, Class<D> destinationClass)
           
<S,D> D[]
mapAsArray(D[] destination, S[] source, Class<D> destinationClass, MappingContext context)
           
<S,D> D[]
mapAsArray(D[] destination, S[] source, Type<S> sourceType, Type<D> destinationType)
           
<S,D> D[]
mapAsArray(D[] destination, S[] source, Type<S> sourceType, Type<D> destinationType, MappingContext context)
           
<S,D> void
mapAsCollection(Iterable<S> source, Collection<D> destination, Class<D> destinationClass)
          Map an iterable onto an existing collection
<S,D> void
mapAsCollection(Iterable<S> source, Collection<D> destination, Class<D> destinationClass, MappingContext context)
          Map an iterable onto an existing collection
<S,D> void
mapAsCollection(Iterable<S> source, Collection<D> destination, Type<S> sourceType, Type<D> destinationType)
          Map an iterable onto an existing collection
<S,D> void
mapAsCollection(Iterable<S> source, Collection<D> destination, Type<S> sourceType, Type<D> destinationType, MappingContext context)
          Map an iterable onto an existing collection
<S,D> void
mapAsCollection(S[] source, Collection<D> destination, Class<D> destinationCollection)
          Map an array onto an existing collection
<S,D> void
mapAsCollection(S[] source, Collection<D> destination, Class<D> destinationCollection, MappingContext context)
          Map an array onto an existing collection
<S,D> void
mapAsCollection(S[] source, Collection<D> destination, Type<S> sourceType, Type<D> destinationType)
          Map an array onto an existing collection
<S,D> void
mapAsCollection(S[] source, Collection<D> destination, Type<S> sourceType, Type<D> destinationType, MappingContext context)
          Map an array onto an existing collection
<S,D> List<D>
mapAsList(Iterable<S> source, Class<D> destinationClass)
          Maps the source Iterable into a new List parameterized by destinationClass.
<S,D> List<D>
mapAsList(Iterable<S> source, Class<D> destinationClass, MappingContext context)
          Maps the source Iterable into a new List parameterized by destinationClass.
<S,D> List<D>
mapAsList(Iterable<S> source, Type<S> sourceType, Type<D> destinationType)
           
<S,D> List<D>
mapAsList(Iterable<S> source, Type<S> sourceType, Type<D> destinationType, MappingContext context)
           
<Sk,Sv,D> List<D>
mapAsList(Map<Sk,Sv> source, Type<? extends Map<Sk,Sv>> sourceType, Type<D> destinationType)
           
<Sk,Sv,D> List<D>
mapAsList(Map<Sk,Sv> source, Type<? extends Map<Sk,Sv>> sourceType, Type<D> destinationType, MappingContext context)
           
<S,D> List<D>
mapAsList(S[] source, Class<D> destinationClass)
          Maps the source Array into a new List parameterized by destinationClass.
<S,D> List<D>
mapAsList(S[] source, Class<D> destinationClass, MappingContext context)
          Maps the source Array into a new List parameterized by destinationClass.
<S,D> List<D>
mapAsList(S[] source, Type<S> sourceType, Type<D> destinationType)
           
<S,D> List<D>
mapAsList(S[] source, Type<S> sourceType, Type<D> destinationType, MappingContext context)
           
<S,Dk,Dv> Map<Dk,Dv>
mapAsMap(Iterable<S> source, Type<S> sourceType, Type<? extends Map<Dk,Dv>> destinationType)
           
<S,Dk,Dv> Map<Dk,Dv>
mapAsMap(Iterable<S> source, Type<S> sourceType, Type<? extends Map<Dk,Dv>> destinationType, MappingContext context)
           
<Sk,Sv,Dk,Dv>
Map<Dk,Dv>
mapAsMap(Map<Sk,Sv> source, Type<? extends Map<Sk,Sv>> sourceType, Type<? extends Map<Dk,Dv>> destinationType)
          Map from one instance of java.util.Map to another.
<Sk,Sv,Dk,Dv>
Map<Dk,Dv>
mapAsMap(Map<Sk,Sv> source, Type<? extends Map<Sk,Sv>> sourceType, Type<? extends Map<Dk,Dv>> destinationType, MappingContext context)
          Map from one instance of java.util.Map to another.
<S,Dk,Dv> Map<Dk,Dv>
mapAsMap(S[] source, Type<S> sourceType, Type<? extends Map<Dk,Dv>> destinationType)
           
<S,Dk,Dv> Map<Dk,Dv>
mapAsMap(S[] source, Type<S> sourceType, Type<? extends Map<Dk,Dv>> destinationType, MappingContext context)
           
<S,D> Set<D>
mapAsSet(Iterable<S> source, Class<D> destinationClass)
          Maps the source iterable into a new Set parameterized by destinationClass.
<S,D> Set<D>
mapAsSet(Iterable<S> source, Class<D> destinationClass, MappingContext context)
          Maps the source iterable into a new Set parameterized by destinationClass.
<S,D> Set<D>
mapAsSet(Iterable<S> source, Type<S> sourceType, Type<D> destinationType)
           
<S,D> Set<D>
mapAsSet(Iterable<S> source, Type<S> sourceType, Type<D> destinationType, MappingContext context)
           
<Sk,Sv,D> Set<D>
mapAsSet(Map<Sk,Sv> source, Type<? extends Map<Sk,Sv>> sourceType, Type<D> destinationType)
           
<Sk,Sv,D> Set<D>
mapAsSet(Map<Sk,Sv> source, Type<? extends Map<Sk,Sv>> sourceType, Type<D> destinationType, MappingContext context)
           
<S,D> Set<D>
mapAsSet(S[] source, Class<D> destinationClass)
          Maps the source Array into a new Set parameterized by destinationClass.
<S,D> Set<D>
mapAsSet(S[] source, Class<D> destinationClass, MappingContext context)
          Maps the source Array into a new Set parameterized by destinationClass.
<S,D> Set<D>
mapAsSet(S[] source, Type<S> sourceType, Type<D> destinationType)
           
<S,D> Set<D>
mapAsSet(S[] source, Type<S> sourceType, Type<D> destinationType, MappingContext context)
           
<S,D> D
newObject(S source, Type<? extends D> destinationClass, MappingContext context)
          Create new instance of a destination class.
<S,D> MappingStrategy
resolveMappingStrategy(S sourceObject, Type rawAType, Type rawBType, boolean mapInPlace, MappingContext context)
          Resolves a reusable MappingStrategy for the given set of inputs.
 

Method Detail

map

<S,D> D map(S sourceObject,
            Class<D> destinationClass)
Create and return a new instance of type D mapped with the properties of sourceObject.

Parameters:
sourceObject - the object to map from
destinationClass - the type of the new object to return
Returns:
a new instance of type D mapped with the properties of sourceObject

map

<S,D> D map(S sourceObject,
            Class<D> destinationClass,
            MappingContext context)
Create and return a new instance of type D mapped with the properties of sourceObject.

Parameters:
sourceObject - the object to map from
destinationClass - the type of the new object to return
context - the context from the current mapping request
Returns:
a new instance of type D mapped with the properties of sourceObject

map

<S,D> void map(S sourceObject,
               D destinationObject)
Maps the properties of sourceObject onto destinationObject.

Parameters:
sourceObject - the object from which to read the properties
destinationObject - the object onto which the properties should be mapped

map

<S,D> void map(S sourceObject,
               D destinationObject,
               MappingContext context)
Maps the properties of sourceObject onto destinationObject.

Parameters:
sourceObject - the object from which to read the properties
destinationObject - the object onto which the properties should be mapped
context - the context from the current mapping request

map

<S,D> void map(S sourceObject,
               D destinationObject,
               Type<S> sourceType,
               Type<D> destinationType)
Maps the properties of sourceObject onto destinationObject, using sourceType and destinationType to specify the parameterized types of the source and destination object.

Parameters:
sourceObject - the object from which to read the properties
destinationObject - the object onto which the properties should be mapped
sourceType - the parameterized type of the source object
destinationType - the parameterized type of the destination object

map

<S,D> void map(S sourceObject,
               D destinationObject,
               Type<S> sourceType,
               Type<D> destinationType,
               MappingContext context)
Maps the properties of sourceObject onto destinationObject, using sourceType and destinationType to specify the parameterized types of the source and destination object.

Parameters:
sourceObject - the object from which to read the properties
destinationObject - the object onto which the properties should be mapped
sourceType - the parameterized type of the source object
destinationType - the parameterized type of the destination object
context - the context from the current mapping request

mapAsSet

<S,D> Set<D> mapAsSet(Iterable<S> source,
                      Class<D> destinationClass)
Maps the source iterable into a new Set parameterized by destinationClass.

Parameters:
source - the Iterable from which to map
destinationClass - the type of elements to be contained in the returned Set.
Returns:
a new Set containing elements of type destinationClass mapped from the elements of source.

mapAsSet

<S,D> Set<D> mapAsSet(Iterable<S> source,
                      Class<D> destinationClass,
                      MappingContext context)
Maps the source iterable into a new Set parameterized by destinationClass.

Parameters:
source - the Iterable from which to map
destinationClass - the type of elements to be contained in the returned Set.
context - the context from the current mapping request
Returns:
a new Set containing elements of type destinationClass mapped from the elements of source.

mapAsSet

<S,D> Set<D> mapAsSet(S[] source,
                      Class<D> destinationClass)
Maps the source Array into a new Set parameterized by destinationClass.

Parameters:
source - the Array from which to map
destinationClass - the type of elements to be contained in the returned Set.
Returns:
a new Set containing elements of type destinationClass mapped from the elements of source.

mapAsSet

<S,D> Set<D> mapAsSet(S[] source,
                      Class<D> destinationClass,
                      MappingContext context)
Maps the source Array into a new Set parameterized by destinationClass.

Parameters:
source - the Array from which to map
destinationClass - the type of elements to be contained in the returned Set.
context - the context from the current mapping request
Returns:
a new Set containing elements of type destinationClass mapped from the elements of source.

mapAsList

<S,D> List<D> mapAsList(Iterable<S> source,
                        Class<D> destinationClass)
Maps the source Iterable into a new List parameterized by destinationClass.

Parameters:
source - the Iterable from which to map
destinationClass - the type of elements to be contained in the returned Set.
Returns:
a new List containing elements of type destinationClass mapped from the elements of source.

mapAsList

<S,D> List<D> mapAsList(Iterable<S> source,
                        Class<D> destinationClass,
                        MappingContext context)
Maps the source Iterable into a new List parameterized by destinationClass.

Parameters:
source - the Iterable from which to map
destinationClass - the type of elements to be contained in the returned Set.
context - the context from the current mapping request
Returns:
a new List containing elements of type destinationClass mapped from the elements of source.

mapAsList

<S,D> List<D> mapAsList(S[] source,
                        Class<D> destinationClass)
Maps the source Array into a new List parameterized by destinationClass.

Parameters:
source - the Array from which to map
destinationClass - the type of elements to be contained in the returned Set.
Returns:
a new List containing elements of type destinationClass mapped from the elements of source.

mapAsList

<S,D> List<D> mapAsList(S[] source,
                        Class<D> destinationClass,
                        MappingContext context)
Maps the source Array into a new List parameterized by destinationClass.

Parameters:
source - the Array from which to map
destinationClass - the type of elements to be contained in the returned Set.
context - the context from the current mapping request
Returns:
a new List containing elements of type destinationClass mapped from the elements of source.

mapAsArray

<S,D> D[] mapAsArray(D[] destination,
                     Iterable<S> source,
                     Class<D> destinationClass)
Maps the source Array into a new Array of typeD.

Parameters:
source - the Array from which to map
destinationClass - the type of elements to be contained in the returned Set.
context - the context from the current mapping request
Returns:
a new Array containing elements of type destinationClass mapped from the elements of source.

mapAsArray

<S,D> D[] mapAsArray(D[] destination,
                     S[] source,
                     Class<D> destinationClass)

mapAsArray

<S,D> D[] mapAsArray(D[] destination,
                     Iterable<S> source,
                     Class<D> destinationClass,
                     MappingContext context)

mapAsArray

<S,D> D[] mapAsArray(D[] destination,
                     S[] source,
                     Class<D> destinationClass,
                     MappingContext context)

mapAsCollection

<S,D> void mapAsCollection(Iterable<S> source,
                           Collection<D> destination,
                           Class<D> destinationClass)
Map an iterable onto an existing collection

Parameters:
source - the source iterable
destination - the destination collection
destinationClass - the type of elements in the destination

mapAsCollection

<S,D> void mapAsCollection(Iterable<S> source,
                           Collection<D> destination,
                           Class<D> destinationClass,
                           MappingContext context)
Map an iterable onto an existing collection

Parameters:
source - the source iterable
destination - the destination collection
destinationClass - the type of elements in the destination
context - the current mapping context

mapAsCollection

<S,D> void mapAsCollection(S[] source,
                           Collection<D> destination,
                           Class<D> destinationCollection)
Map an array onto an existing collection

Parameters:
source - the source array
destination - the destination collection
destinationClass - the type of elements in the destination

mapAsCollection

<S,D> void mapAsCollection(S[] source,
                           Collection<D> destination,
                           Class<D> destinationCollection,
                           MappingContext context)
Map an array onto an existing collection

Parameters:
source - the source array
destination - the destination collection
destinationClass - the type of elements in the destination
context - the current mapping context

map

<S,D> D map(S sourceObject,
            Type<S> sourceType,
            Type<D> destinationType)

map

<S,D> D map(S sourceObject,
            Type<S> sourceType,
            Type<D> destinationType,
            MappingContext context)

mapAsSet

<S,D> Set<D> mapAsSet(Iterable<S> source,
                      Type<S> sourceType,
                      Type<D> destinationType)

mapAsSet

<S,D> Set<D> mapAsSet(Iterable<S> source,
                      Type<S> sourceType,
                      Type<D> destinationType,
                      MappingContext context)

mapAsSet

<S,D> Set<D> mapAsSet(S[] source,
                      Type<S> sourceType,
                      Type<D> destinationType)

mapAsSet

<S,D> Set<D> mapAsSet(S[] source,
                      Type<S> sourceType,
                      Type<D> destinationType,
                      MappingContext context)

mapAsList

<S,D> List<D> mapAsList(Iterable<S> source,
                        Type<S> sourceType,
                        Type<D> destinationType)

mapAsList

<S,D> List<D> mapAsList(Iterable<S> source,
                        Type<S> sourceType,
                        Type<D> destinationType,
                        MappingContext context)

mapAsList

<S,D> List<D> mapAsList(S[] source,
                        Type<S> sourceType,
                        Type<D> destinationType)

mapAsList

<S,D> List<D> mapAsList(S[] source,
                        Type<S> sourceType,
                        Type<D> destinationType,
                        MappingContext context)

mapAsArray

<S,D> D[] mapAsArray(D[] destination,
                     Iterable<S> source,
                     Type<S> sourceType,
                     Type<D> destinationType)

mapAsArray

<S,D> D[] mapAsArray(D[] destination,
                     S[] source,
                     Type<S> sourceType,
                     Type<D> destinationType)

mapAsArray

<S,D> D[] mapAsArray(D[] destination,
                     Iterable<S> source,
                     Type<S> sourceType,
                     Type<D> destinationType,
                     MappingContext context)

mapAsArray

<S,D> D[] mapAsArray(D[] destination,
                     S[] source,
                     Type<S> sourceType,
                     Type<D> destinationType,
                     MappingContext context)

mapAsCollection

<S,D> void mapAsCollection(Iterable<S> source,
                           Collection<D> destination,
                           Type<S> sourceType,
                           Type<D> destinationType)
Map an iterable onto an existing collection

Parameters:
source - the source iterable
destination - the destination collection
sourceType - the type of elements in the source
destinationType - the type of elements in the destination

mapAsCollection

<S,D> void mapAsCollection(Iterable<S> source,
                           Collection<D> destination,
                           Type<S> sourceType,
                           Type<D> destinationType,
                           MappingContext context)
Map an iterable onto an existing collection

Parameters:
source - the source iterable
destination - the destination collection
sourceType - the type of elements in the source
destinationType - the type of elements in the destination
context - the current mapping context

mapAsCollection

<S,D> void mapAsCollection(S[] source,
                           Collection<D> destination,
                           Type<S> sourceType,
                           Type<D> destinationType)
Map an array onto an existing collection

Parameters:
source - the source array
destination - the destination collection
sourceType - the type of elements in the source
destinationType - the type of elements in the destination

mapAsCollection

<S,D> void mapAsCollection(S[] source,
                           Collection<D> destination,
                           Type<S> sourceType,
                           Type<D> destinationType,
                           MappingContext context)
Map an array onto an existing collection

Parameters:
source - the source array
destination - the destination collection
sourceType - the type of elements in the source
destinationType - the type of elements in the destination
context - the current mapping context

convert

<S,D> D convert(S source,
                Type<S> sourceType,
                Type<D> destinationType,
                String converterId)
Convert the source object into the appropriate destination type

Parameters:
source - the source object to map
sourceType - the type of the source object
destinationType - the type of the destination object to produce
converterId - the specific converter to use; if null, the first compatible global converter is used
Returns:

mapAsMap

<Sk,Sv,Dk,Dv> Map<Dk,Dv> mapAsMap(Map<Sk,Sv> source,
                                  Type<? extends Map<Sk,Sv>> sourceType,
                                  Type<? extends Map<Dk,Dv>> destinationType)
Map from one instance of java.util.Map to another.

Parameters:
source - the source Map
sourceType - the parameterized type of the source Map object
destinationType - the parameterized type of the destination Map object
Returns:
a new Map instance, with key and value types as defined by destinationType

mapAsMap

<Sk,Sv,Dk,Dv> Map<Dk,Dv> mapAsMap(Map<Sk,Sv> source,
                                  Type<? extends Map<Sk,Sv>> sourceType,
                                  Type<? extends Map<Dk,Dv>> destinationType,
                                  MappingContext context)
Map from one instance of java.util.Map to another.

Parameters:
source -
sourceType -
destinationType -
context - context the context from the current mapping request
Returns:
a new Map instance, with key and value types as defined by destinationType

mapAsMap

<S,Dk,Dv> Map<Dk,Dv> mapAsMap(Iterable<S> source,
                              Type<S> sourceType,
                              Type<? extends Map<Dk,Dv>> destinationType)

mapAsMap

<S,Dk,Dv> Map<Dk,Dv> mapAsMap(Iterable<S> source,
                              Type<S> sourceType,
                              Type<? extends Map<Dk,Dv>> destinationType,
                              MappingContext context)

mapAsMap

<S,Dk,Dv> Map<Dk,Dv> mapAsMap(S[] source,
                              Type<S> sourceType,
                              Type<? extends Map<Dk,Dv>> destinationType)

mapAsMap

<S,Dk,Dv> Map<Dk,Dv> mapAsMap(S[] source,
                              Type<S> sourceType,
                              Type<? extends Map<Dk,Dv>> destinationType,
                              MappingContext context)

mapAsList

<Sk,Sv,D> List<D> mapAsList(Map<Sk,Sv> source,
                            Type<? extends Map<Sk,Sv>> sourceType,
                            Type<D> destinationType)

mapAsList

<Sk,Sv,D> List<D> mapAsList(Map<Sk,Sv> source,
                            Type<? extends Map<Sk,Sv>> sourceType,
                            Type<D> destinationType,
                            MappingContext context)

mapAsSet

<Sk,Sv,D> Set<D> mapAsSet(Map<Sk,Sv> source,
                          Type<? extends Map<Sk,Sv>> sourceType,
                          Type<D> destinationType)

mapAsSet

<Sk,Sv,D> Set<D> mapAsSet(Map<Sk,Sv> source,
                          Type<? extends Map<Sk,Sv>> sourceType,
                          Type<D> destinationType,
                          MappingContext context)

mapAsArray

<Sk,Sv,D> D[] mapAsArray(D[] destination,
                         Map<Sk,Sv> source,
                         Type<? extends Map<Sk,Sv>> sourceType,
                         Type<D> destinationType)

mapAsArray

<Sk,Sv,D> D[] mapAsArray(D[] destination,
                         Map<Sk,Sv> source,
                         Type<? extends Map<Sk,Sv>> sourceType,
                         Type<D> destinationType,
                         MappingContext context)

convert

<S,D> D convert(S source,
                Class<D> destinationClass,
                String converterId)

newObject

<S,D> D newObject(S source,
                  Type<? extends D> destinationClass,
                  MappingContext context)
Create new instance of a destination class. Abstract types are unsupported.

Parameters:
source -
destinationClass -
Returns:
new instance of destinationClass

resolveMappingStrategy

<S,D> MappingStrategy resolveMappingStrategy(S sourceObject,
                                             Type rawAType,
                                             Type rawBType,
                                             boolean mapInPlace,
                                             MappingContext context)
Resolves a reusable MappingStrategy for the given set of inputs.

Parameters:
sourceObject - the source object to map
rawAType - the source type
rawBType - the destination type
context - the current MappingContext
Returns:


Copyright © 2013 Glasnost. All Rights Reserved.