be.idamf.sofa.mapper
Class AbstractBidirectionalStrategyMapper<A,B>

java.lang.Object
  extended by be.idamf.sofa.mapper.AbstractMapper<A,B>
      extended by be.idamf.sofa.mapper.AbstractBidirectionalMapper<A,B>
          extended by be.idamf.sofa.mapper.AbstractBidirectionalStrategyMapper<A,B>
Type Parameters:
A - The object type A
B - The object type B
All Implemented Interfaces:
BidirectionalMapper<A,B>, Mapper<A,B>, StrategyMapper<A,B>

public abstract class AbstractBidirectionalStrategyMapper<A,B>
extends AbstractBidirectionalMapper<A,B>
implements StrategyMapper<A,B>

Abstract mapper class, implementing the B to A mapping methods as delegation to the strategy. Implementing classes must provide a default StrategyMapper. This strategy will be used when calling BidirectionalMapper.mapBToA(Object).


Constructor Summary
protected AbstractBidirectionalStrategyMapper(MapperStrategy<A,B> defaultStrategy)
          This constructor foreces implementation to always pass in a default strategy, so it can be used when BidirectionalMapper.mapBToA(Object) is called.
 
Method Summary
 A mapBToA(B b)
          Map an object of type B to an object of type A.
 A mapBToA(B b, MapperStrategy<A,B> strategy)
          Map an object of type B to an object of type A, using a given strategy.
<C extends Collection<A>>
C
mapCollectionOfBToCollectionOfA(Collection<B> collectionOfB, C emptyMutableCollectionOfA, MapperStrategy<A,B> strategy)
          Maps a collection of objects of type B to a collection of objects of type A, using a strategy.
 
Methods inherited from class be.idamf.sofa.mapper.AbstractBidirectionalMapper
mapCollectionOfBToCollectionOfA
 
Methods inherited from class be.idamf.sofa.mapper.AbstractMapper
mapCollectionOfAToCollectionOfB
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface be.idamf.sofa.mapper.BidirectionalMapper
mapCollectionOfBToCollectionOfA
 
Methods inherited from interface be.idamf.sofa.mapper.Mapper
mapAToB, mapCollectionOfAToCollectionOfB
 

Constructor Detail

AbstractBidirectionalStrategyMapper

protected AbstractBidirectionalStrategyMapper(MapperStrategy<A,B> defaultStrategy)
This constructor foreces implementation to always pass in a default strategy, so it can be used when BidirectionalMapper.mapBToA(Object) is called.

Parameters:
defaultStrategy - the default strategy
Method Detail

mapBToA

public A mapBToA(B b,
                 MapperStrategy<A,B> strategy)
Map an object of type B to an object of type A, using a given strategy.

Specified by:
mapBToA in interface StrategyMapper<A,B>
Parameters:
b - the object of type B
strategy - the strategy
Returns:
an object of type A

mapBToA

public A mapBToA(B b)
Map an object of type B to an object of type A.

Specified by:
mapBToA in interface BidirectionalMapper<A,B>
Parameters:
b - the object of type B
Returns:
an object of type A

mapCollectionOfBToCollectionOfA

public <C extends Collection<A>> C mapCollectionOfBToCollectionOfA(Collection<B> collectionOfB,
                                                                   C emptyMutableCollectionOfA,
                                                                   MapperStrategy<A,B> strategy)
Maps a collection of objects of type B to a collection of objects of type A, using a strategy.

Specified by:
mapCollectionOfBToCollectionOfA in interface StrategyMapper<A,B>
Parameters:
collectionOfB - the collection of objects of type B
strategy - the strategy
Returns:
a collection of objects of type A


Copyright © 2013 iDA-MediaFoundry. All Rights Reserved.