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

java.lang.Object
  extended by ma.glasnost.orika.impl.mapping.strategy.MappingStrategyRecorder

public class MappingStrategyRecorder
extends Object

MappingStrategyRecorder is used to record the important details regarding the branch logic and component lookups performed for a given set of input types.
After recording these details, it can be used to generate an appropriate MappingStrategy instance which can be cached and reused for that particular set of inputs.

Author:
matt.deboer@gmail.com

Constructor Summary
MappingStrategyRecorder(MappingStrategyKey key, UnenhanceStrategy unenhanceStrategy)
           
 
Method Summary
 String describeDetails()
          Describes the details of the strategy chosen for this particular set of inputs
 Converter<Object,Object> getResolvedConverter()
           
 Type<?> getResolvedDestinationType()
           
 Mapper<Object,Object> getResolvedMapper()
           
 ObjectFactory<Object> getResolvedObjectFactory()
           
 Type<?> getResolvedSourceType()
           
 boolean isCopyByReference()
           
 boolean isInstantiate()
           
 boolean isMapReverse()
           
 boolean isUnenhance()
           
 MappingStrategy playback()
           
 void setCopyByReference(boolean copyByReference)
          Set whether the strategy should use copy-by-reference
 void setInstantiate(boolean instantiate)
          Sets whether the strategy should create new instances
 void setMapReverse(boolean mapReverse)
          Set whether this strategy should map in reverse
 void setResolvedConverter(Converter<Object,Object> resolvedConverter)
          Set the converter that should be used by the MappingStrategy
 void setResolvedDestinationType(Type<?> resolvedDestinationType)
          Set the destination type to be used with the strategy
 void setResolvedMapper(Mapper<Object,Object> resolvedMapper)
          Sets the mapper to be used with the strategy
 void setResolvedObjectFactory(ObjectFactory<?> resolvedObjectFactory)
          Set the ObjectFactory to use for the strategy
 void setResolvedSourceType(Type<?> resolvedSourceType)
          Sets the source type that should be used with the strategy
 void setUnenhance(boolean unenhance)
          Sets whether the strategy should perform unenhancement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MappingStrategyRecorder

public MappingStrategyRecorder(MappingStrategyKey key,
                               UnenhanceStrategy unenhanceStrategy)
Parameters:
key -
unenhanceStrategy -
Method Detail

isUnenhance

public boolean isUnenhance()
Returns:
true if the strategy should use unenhancement

isInstantiate

public boolean isInstantiate()
Returns:
true of the strategy should instantiate new instances

setInstantiate

public void setInstantiate(boolean instantiate)
Sets whether the strategy should create new instances

Parameters:
instantiate -

setUnenhance

public void setUnenhance(boolean unenhance)
Sets whether the strategy should perform unenhancement

Parameters:
unenhance -

getResolvedConverter

public Converter<Object,Object> getResolvedConverter()
Returns:
the converter resolved for this strategy

setResolvedConverter

public void setResolvedConverter(Converter<Object,Object> resolvedConverter)
Set the converter that should be used by the MappingStrategy

Parameters:
resolvedConverter -

getResolvedSourceType

public Type<?> getResolvedSourceType()
Returns:
the source type for the strategy

setResolvedSourceType

public void setResolvedSourceType(Type<?> resolvedSourceType)
Sets the source type that should be used with the strategy

Parameters:
resolvedSourceType -

getResolvedDestinationType

public Type<?> getResolvedDestinationType()
Returns:
the destination type for the strategy

setResolvedDestinationType

public void setResolvedDestinationType(Type<?> resolvedDestinationType)
Set the destination type to be used with the strategy

Parameters:
resolvedDestinationType -

isCopyByReference

public boolean isCopyByReference()
Returns:
true if the strategy should use copy-by-reference

setCopyByReference

public void setCopyByReference(boolean copyByReference)
Set whether the strategy should use copy-by-reference

Parameters:
copyByReference -

isMapReverse

public boolean isMapReverse()
Returns:
true if the strategy should map in reverse

setMapReverse

public void setMapReverse(boolean mapReverse)
Set whether this strategy should map in reverse

Parameters:
mapReverse -

getResolvedMapper

public Mapper<Object,Object> getResolvedMapper()
Returns:
the mapper resolved for the strategy

setResolvedMapper

public void setResolvedMapper(Mapper<Object,Object> resolvedMapper)
Sets the mapper to be used with the strategy

Parameters:
resolvedMapper -

getResolvedObjectFactory

public ObjectFactory<Object> getResolvedObjectFactory()
Returns:
the ObjectFactory to use for the strategy

setResolvedObjectFactory

public void setResolvedObjectFactory(ObjectFactory<?> resolvedObjectFactory)
Set the ObjectFactory to use for the strategy

Parameters:
resolvedObjectFactory -

playback

public MappingStrategy playback()
Returns:
a new instance of the MappingStrategy which can "playback" the route taken to map a given set of inputs.

describeDetails

public String describeDetails()
Describes the details of the strategy chosen for this particular set of inputs

Returns:
a String description of this strategy suitable for logging


Copyright © 2013 Glasnost. All Rights Reserved.