ma.glasnost.orika.impl
Class ConfigurableMapper

java.lang.Object
  extended by ma.glasnost.orika.impl.ConfigurableMapper
All Implemented Interfaces:
MapperFacade

public class ConfigurableMapper
extends Object
implements MapperFacade

ConfigurableMapper is a convenience type which provides a simplification for reuse of a particular Orika mapping configuration in a given context.

It can be especially useful in a Spring context where you'd like initialize Orika with particular configuration(s) at startup and reuse the MapperFacade.
Simply wire your own extension of ConfigurableMapper containing your own configurations and use it as you would the MapperFacade you'd normally retrieve from MapperFactory.

ConfigurableMapper should be extended, overriding the configure(MapperFactory) method to provide the necessary initializations and customizations desired.

Additionally, if customizations are needed to the DefaultMapperFactory builder (used by ConfigurableMapper), the configureFactoryBuilder(ma.glasnost.orika.impl.DefaultMapperFactory.Builder) method may be overridden to apply custom parameters to the builder used to obtain the MapperFactory.

For example:

 public class MyCustomMapper extends ConfigurableMapper {
 
    protected void configure(MapperFactory factory) {
       
       factory.registerClassMapping(...);
       
       factory.getConverterFactory().registerConverter(...);
       
       factory.registerDefaultMappingHint(...);
     
    }
 }
 
 ...
 
 public class SomeOtherClass {
 
    private MapperFacade mapper = new MyCustomMapper();
 
    void someMethod() {
       
       mapper.map(blah, Blah.class);
       ...
    }
    ...
 }
 

Author:
matt.deboer@gmail.com

Constructor Summary
protected ConfigurableMapper()
           
 
Method Summary
protected  void configure(MapperFactory factory)
          Implement this method to provide your own configurations to the Orika MapperFactory used by this mapper.
protected  void configureFactoryBuilder(DefaultMapperFactory.Builder factoryBuilder)
          Override this method only if you need to customize any of the parameters passed to the factory builder, in the case that you've provided your own custom implementation of one of the core components of Orika.
<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
<A,B> BoundMapperFacade<A,B>
dedicatedMapperFor(Class<A> aType, Class<B> bType)
           
<A,B> BoundMapperFacade<A,B>
dedicatedMapperFor(Class<A> aType, Class<B> bType, boolean containsCycles)
           
<S,D> BoundMapperFacade<S,D>
dedicatedMapperFor(Type<S> sourceType, Type<D> destinationType)
           
<S,D> BoundMapperFacade<S,D>
dedicatedMapperFor(Type<S> sourceType, Type<D> destinationType, boolean containsCycles)
           
<S,D> D
map(S sourceObject, Class<D> destinationClass)
          Delegate methods for MapperFacade;
<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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurableMapper

protected ConfigurableMapper()
Method Detail

configure

protected void configure(MapperFactory factory)
Implement this method to provide your own configurations to the Orika MapperFactory used by this mapper.

Parameters:
factory - the MapperFactory instance which may be used to register various configurations, mappings, etc.

configureFactoryBuilder

protected void configureFactoryBuilder(DefaultMapperFactory.Builder factoryBuilder)
Override this method only if you need to customize any of the parameters passed to the factory builder, in the case that you've provided your own custom implementation of one of the core components of Orika.

Parameters:
factoryBuilder - the builder which will be used to obtain a MapperFactory instance

map

public <S,D> D map(S sourceObject,
                   Class<D> destinationClass)
Delegate methods for MapperFacade;

Specified by:
map in interface MapperFacade
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

public <S,D> D map(S sourceObject,
                   Class<D> destinationClass,
                   MappingContext context)
Description copied from interface: MapperFacade
Create and return a new instance of type D mapped with the properties of sourceObject.

Specified by:
map in interface MapperFacade
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

public <S,D> void map(S sourceObject,
                      D destinationObject)
Description copied from interface: MapperFacade
Maps the properties of sourceObject onto destinationObject.

Specified by:
map in interface MapperFacade
Parameters:
sourceObject - the object from which to read the properties
destinationObject - the object onto which the properties should be mapped

map

public <S,D> void map(S sourceObject,
                      D destinationObject,
                      MappingContext context)
Description copied from interface: MapperFacade
Maps the properties of sourceObject onto destinationObject.

Specified by:
map in interface MapperFacade
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

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

Specified by:
map in interface MapperFacade
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

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

Specified by:
map in interface MapperFacade
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

public <S,D> Set<D> mapAsSet(Iterable<S> source,
                             Class<D> destinationClass)
Description copied from interface: MapperFacade
Maps the source iterable into a new Set parameterized by destinationClass.

Specified by:
mapAsSet in interface MapperFacade
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

public <S,D> Set<D> mapAsSet(Iterable<S> source,
                             Class<D> destinationClass,
                             MappingContext context)
Description copied from interface: MapperFacade
Maps the source iterable into a new Set parameterized by destinationClass.

Specified by:
mapAsSet in interface MapperFacade
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

public <S,D> Set<D> mapAsSet(S[] source,
                             Class<D> destinationClass)
Description copied from interface: MapperFacade
Maps the source Array into a new Set parameterized by destinationClass.

Specified by:
mapAsSet in interface MapperFacade
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

public <S,D> Set<D> mapAsSet(S[] source,
                             Class<D> destinationClass,
                             MappingContext context)
Description copied from interface: MapperFacade
Maps the source Array into a new Set parameterized by destinationClass.

Specified by:
mapAsSet in interface MapperFacade
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

public <S,D> List<D> mapAsList(Iterable<S> source,
                               Class<D> destinationClass)
Description copied from interface: MapperFacade
Maps the source Iterable into a new List parameterized by destinationClass.

Specified by:
mapAsList in interface MapperFacade
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

public <S,D> List<D> mapAsList(Iterable<S> source,
                               Class<D> destinationClass,
                               MappingContext context)
Description copied from interface: MapperFacade
Maps the source Iterable into a new List parameterized by destinationClass.

Specified by:
mapAsList in interface MapperFacade
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

public <S,D> List<D> mapAsList(S[] source,
                               Class<D> destinationClass)
Description copied from interface: MapperFacade
Maps the source Array into a new List parameterized by destinationClass.

Specified by:
mapAsList in interface MapperFacade
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

public <S,D> List<D> mapAsList(S[] source,
                               Class<D> destinationClass,
                               MappingContext context)
Description copied from interface: MapperFacade
Maps the source Array into a new List parameterized by destinationClass.

Specified by:
mapAsList in interface MapperFacade
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

public <S,D> D[] mapAsArray(D[] destination,
                            Iterable<S> source,
                            Class<D> destinationClass)
Description copied from interface: MapperFacade
Maps the source Array into a new Array of typeD.

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

mapAsArray

public <S,D> D[] mapAsArray(D[] destination,
                            S[] source,
                            Class<D> destinationClass)
Specified by:
mapAsArray in interface MapperFacade

mapAsArray

public <S,D> D[] mapAsArray(D[] destination,
                            Iterable<S> source,
                            Class<D> destinationClass,
                            MappingContext context)
Specified by:
mapAsArray in interface MapperFacade

mapAsArray

public <S,D> D[] mapAsArray(D[] destination,
                            S[] source,
                            Class<D> destinationClass,
                            MappingContext context)
Specified by:
mapAsArray in interface MapperFacade

map

public <S,D> D map(S sourceObject,
                   Type<S> sourceType,
                   Type<D> destinationType)
Specified by:
map in interface MapperFacade

map

public <S,D> D map(S sourceObject,
                   Type<S> sourceType,
                   Type<D> destinationType,
                   MappingContext context)
Specified by:
map in interface MapperFacade

mapAsSet

public <S,D> Set<D> mapAsSet(Iterable<S> source,
                             Type<S> sourceType,
                             Type<D> destinationType)
Specified by:
mapAsSet in interface MapperFacade

mapAsSet

public <S,D> Set<D> mapAsSet(Iterable<S> source,
                             Type<S> sourceType,
                             Type<D> destinationType,
                             MappingContext context)
Specified by:
mapAsSet in interface MapperFacade

mapAsSet

public <S,D> Set<D> mapAsSet(S[] source,
                             Type<S> sourceType,
                             Type<D> destinationType)
Specified by:
mapAsSet in interface MapperFacade

mapAsSet

public <S,D> Set<D> mapAsSet(S[] source,
                             Type<S> sourceType,
                             Type<D> destinationType,
                             MappingContext context)
Specified by:
mapAsSet in interface MapperFacade

mapAsList

public <S,D> List<D> mapAsList(Iterable<S> source,
                               Type<S> sourceType,
                               Type<D> destinationType)
Specified by:
mapAsList in interface MapperFacade

mapAsList

public <S,D> List<D> mapAsList(Iterable<S> source,
                               Type<S> sourceType,
                               Type<D> destinationType,
                               MappingContext context)
Specified by:
mapAsList in interface MapperFacade

mapAsList

public <S,D> List<D> mapAsList(S[] source,
                               Type<S> sourceType,
                               Type<D> destinationType)
Specified by:
mapAsList in interface MapperFacade

mapAsList

public <S,D> List<D> mapAsList(S[] source,
                               Type<S> sourceType,
                               Type<D> destinationType,
                               MappingContext context)
Specified by:
mapAsList in interface MapperFacade

mapAsArray

public <S,D> D[] mapAsArray(D[] destination,
                            Iterable<S> source,
                            Type<S> sourceType,
                            Type<D> destinationType)
Specified by:
mapAsArray in interface MapperFacade

mapAsArray

public <S,D> D[] mapAsArray(D[] destination,
                            S[] source,
                            Type<S> sourceType,
                            Type<D> destinationType)
Specified by:
mapAsArray in interface MapperFacade

mapAsArray

public <S,D> D[] mapAsArray(D[] destination,
                            Iterable<S> source,
                            Type<S> sourceType,
                            Type<D> destinationType,
                            MappingContext context)
Specified by:
mapAsArray in interface MapperFacade

mapAsArray

public <S,D> D[] mapAsArray(D[] destination,
                            S[] source,
                            Type<S> sourceType,
                            Type<D> destinationType,
                            MappingContext context)
Specified by:
mapAsArray in interface MapperFacade

mapAsCollection

public <S,D> void mapAsCollection(Iterable<S> source,
                                  Collection<D> destination,
                                  Class<D> destinationClass)
Description copied from interface: MapperFacade
Map an iterable onto an existing collection

Specified by:
mapAsCollection in interface MapperFacade
Parameters:
source - the source iterable
destination - the destination collection
destinationClass - the type of elements in the destination

mapAsCollection

public <S,D> void mapAsCollection(Iterable<S> source,
                                  Collection<D> destination,
                                  Class<D> destinationClass,
                                  MappingContext context)
Description copied from interface: MapperFacade
Map an iterable onto an existing collection

Specified by:
mapAsCollection in interface MapperFacade
Parameters:
source - the source iterable
destination - the destination collection
destinationClass - the type of elements in the destination
context - the current mapping context

mapAsCollection

public <S,D> void mapAsCollection(S[] source,
                                  Collection<D> destination,
                                  Class<D> destinationCollection)
Description copied from interface: MapperFacade
Map an array onto an existing collection

Specified by:
mapAsCollection in interface MapperFacade
Parameters:
source - the source array
destination - the destination collection

mapAsCollection

public <S,D> void mapAsCollection(S[] source,
                                  Collection<D> destination,
                                  Class<D> destinationCollection,
                                  MappingContext context)
Description copied from interface: MapperFacade
Map an array onto an existing collection

Specified by:
mapAsCollection in interface MapperFacade
Parameters:
source - the source array
destination - the destination collection
context - the current mapping context

mapAsCollection

public <S,D> void mapAsCollection(Iterable<S> source,
                                  Collection<D> destination,
                                  Type<S> sourceType,
                                  Type<D> destinationType)
Description copied from interface: MapperFacade
Map an iterable onto an existing collection

Specified by:
mapAsCollection in interface MapperFacade
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

public <S,D> void mapAsCollection(S[] source,
                                  Collection<D> destination,
                                  Type<S> sourceType,
                                  Type<D> destinationType)
Description copied from interface: MapperFacade
Map an array onto an existing collection

Specified by:
mapAsCollection in interface MapperFacade
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

public <S,D> void mapAsCollection(Iterable<S> source,
                                  Collection<D> destination,
                                  Type<S> sourceType,
                                  Type<D> destinationType,
                                  MappingContext context)
Description copied from interface: MapperFacade
Map an iterable onto an existing collection

Specified by:
mapAsCollection in interface MapperFacade
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

public <S,D> void mapAsCollection(S[] source,
                                  Collection<D> destination,
                                  Type<S> sourceType,
                                  Type<D> destinationType,
                                  MappingContext context)
Description copied from interface: MapperFacade
Map an array onto an existing collection

Specified by:
mapAsCollection in interface MapperFacade
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

public <S,D> D convert(S source,
                       Type<S> sourceType,
                       Type<D> destinationType,
                       String converterId)
Description copied from interface: MapperFacade
Convert the source object into the appropriate destination type

Specified by:
convert in interface MapperFacade
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:

convert

public <S,D> D convert(S source,
                       Class<D> destinationClass,
                       String converterId)
Specified by:
convert in interface MapperFacade

newObject

public <S,D> D newObject(S source,
                         Type<? extends D> destinationClass,
                         MappingContext context)
Description copied from interface: MapperFacade
Create new instance of a destination class. Abstract types are unsupported.

Specified by:
newObject in interface MapperFacade
Returns:
new instance of destinationClass

mapAsMap

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

Specified by:
mapAsMap in interface MapperFacade
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

public <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)
Description copied from interface: MapperFacade
Map from one instance of java.util.Map to another.

Specified by:
mapAsMap in interface MapperFacade
context - context the context from the current mapping request
Returns:
a new Map instance, with key and value types as defined by destinationType

mapAsMap

public <S,Dk,Dv> Map<Dk,Dv> mapAsMap(Iterable<S> source,
                                     Type<S> sourceType,
                                     Type<? extends Map<Dk,Dv>> destinationType)
Specified by:
mapAsMap in interface MapperFacade

mapAsMap

public <S,Dk,Dv> Map<Dk,Dv> mapAsMap(Iterable<S> source,
                                     Type<S> sourceType,
                                     Type<? extends Map<Dk,Dv>> destinationType,
                                     MappingContext context)
Specified by:
mapAsMap in interface MapperFacade

mapAsMap

public <S,Dk,Dv> Map<Dk,Dv> mapAsMap(S[] source,
                                     Type<S> sourceType,
                                     Type<? extends Map<Dk,Dv>> destinationType)
Specified by:
mapAsMap in interface MapperFacade

mapAsMap

public <S,Dk,Dv> Map<Dk,Dv> mapAsMap(S[] source,
                                     Type<S> sourceType,
                                     Type<? extends Map<Dk,Dv>> destinationType,
                                     MappingContext context)
Specified by:
mapAsMap in interface MapperFacade

mapAsList

public <Sk,Sv,D> List<D> mapAsList(Map<Sk,Sv> source,
                                   Type<? extends Map<Sk,Sv>> sourceType,
                                   Type<D> destinationType)
Specified by:
mapAsList in interface MapperFacade

mapAsList

public <Sk,Sv,D> List<D> mapAsList(Map<Sk,Sv> source,
                                   Type<? extends Map<Sk,Sv>> sourceType,
                                   Type<D> destinationType,
                                   MappingContext context)
Specified by:
mapAsList in interface MapperFacade

mapAsSet

public <Sk,Sv,D> Set<D> mapAsSet(Map<Sk,Sv> source,
                                 Type<? extends Map<Sk,Sv>> sourceType,
                                 Type<D> destinationType)
Specified by:
mapAsSet in interface MapperFacade

mapAsSet

public <Sk,Sv,D> Set<D> mapAsSet(Map<Sk,Sv> source,
                                 Type<? extends Map<Sk,Sv>> sourceType,
                                 Type<D> destinationType,
                                 MappingContext context)
Specified by:
mapAsSet in interface MapperFacade

mapAsArray

public <Sk,Sv,D> D[] mapAsArray(D[] destination,
                                Map<Sk,Sv> source,
                                Type<? extends Map<Sk,Sv>> sourceType,
                                Type<D> destinationType)
Specified by:
mapAsArray in interface MapperFacade

mapAsArray

public <Sk,Sv,D> D[] mapAsArray(D[] destination,
                                Map<Sk,Sv> source,
                                Type<? extends Map<Sk,Sv>> sourceType,
                                Type<D> destinationType,
                                MappingContext context)
Specified by:
mapAsArray in interface MapperFacade

resolveMappingStrategy

public <S,D> MappingStrategy resolveMappingStrategy(S sourceObject,
                                                    Type rawAType,
                                                    Type rawBType,
                                                    boolean mapInPlace,
                                                    MappingContext context)
Description copied from interface: MapperFacade
Resolves a reusable MappingStrategy for the given set of inputs.

Specified by:
resolveMappingStrategy in interface MapperFacade
Parameters:
sourceObject - the source object to map
rawAType - the source type
rawBType - the destination type
context - the current MappingContext
Returns:

dedicatedMapperFor

public <S,D> BoundMapperFacade<S,D> dedicatedMapperFor(Type<S> sourceType,
                                                       Type<D> destinationType)

dedicatedMapperFor

public <S,D> BoundMapperFacade<S,D> dedicatedMapperFor(Type<S> sourceType,
                                                       Type<D> destinationType,
                                                       boolean containsCycles)

dedicatedMapperFor

public <A,B> BoundMapperFacade<A,B> dedicatedMapperFor(Class<A> aType,
                                                       Class<B> bType)

dedicatedMapperFor

public <A,B> BoundMapperFacade<A,B> dedicatedMapperFor(Class<A> aType,
                                                       Class<B> bType,
                                                       boolean containsCycles)


Copyright © 2013 Glasnost. All Rights Reserved.