ma.glasnost.orika.impl.mapping.strategy
Class UseCustomMapperStrategy

java.lang.Object
  extended by ma.glasnost.orika.impl.mapping.strategy.AbstractMappingStrategy
      extended by ma.glasnost.orika.impl.mapping.strategy.UseCustomMapperStrategy
All Implemented Interfaces:
MappingStrategy
Direct Known Subclasses:
InstantiateAndUseCustomMapperStrategy, InstantiateByDefaultAndUseCustomMapperStrategy, MapExistingAndUseCustomMapperStrategy

public abstract class UseCustomMapperStrategy
extends AbstractMappingStrategy

UseCustomMapperStrategy uses a custom mapper to map the source to the destination


Field Summary
protected  Mapper<Object,Object> customMapper
          The custom mapper resolved for this strategy
protected  UnenhanceStrategy unenhancer
          The Unenhancer to be used for this strategy
 
Fields inherited from class ma.glasnost.orika.impl.mapping.strategy.AbstractMappingStrategy
destinationType, sourceType
 
Constructor Summary
UseCustomMapperStrategy(Type<Object> sourceType, Type<Object> destinationType, Mapper<Object,Object> customMapper, UnenhanceStrategy unenhancer)
          Creates a new instance of UseCustomMapperStrategy
 
Method Summary
protected abstract  Object getInstance(Object sourceObject, Object destinationObject, MappingContext context)
          Gets an instance of the destination object to be mapped; may return the provided destinationObject for map-in-place scenarios
 Object map(Object sourceObject, Object destinationObject, MappingContext context)
          Perform the mapping
 
Methods inherited from class ma.glasnost.orika.impl.mapping.strategy.AbstractMappingStrategy
getDestinationType, getSoureType, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

customMapper

protected final Mapper<Object,Object> customMapper
The custom mapper resolved for this strategy


unenhancer

protected final UnenhanceStrategy unenhancer
The Unenhancer to be used for this strategy

Constructor Detail

UseCustomMapperStrategy

public UseCustomMapperStrategy(Type<Object> sourceType,
                               Type<Object> destinationType,
                               Mapper<Object,Object> customMapper,
                               UnenhanceStrategy unenhancer)
Creates a new instance of UseCustomMapperStrategy

Parameters:
sourceType -
destinationType -
customMapper -
unenhancer -
Method Detail

map

public Object map(Object sourceObject,
                  Object destinationObject,
                  MappingContext context)
Description copied from interface: MappingStrategy
Perform the mapping

Parameters:
sourceObject - the source object to map
destinationObject - the pre-instantiated destination object onto which properties should be copied; may be null
context - the current mapping context
Returns:
the mapping result

getInstance

protected abstract Object getInstance(Object sourceObject,
                                      Object destinationObject,
                                      MappingContext context)
Gets an instance of the destination object to be mapped; may return the provided destinationObject for map-in-place scenarios

Parameters:
sourceObject -
destinationObject -
context -
Returns:
an instance of the destination type to be mapped


Copyright © 2013 Glasnost. All Rights Reserved.