ma.glasnost.orika.impl
Class ReversedMapper<A,B>

java.lang.Object
  extended by ma.glasnost.orika.impl.ReversedMapper<A,B>
All Implemented Interfaces:
MappedTypePair<A,B>, Mapper<A,B>

public class ReversedMapper<A,B>
extends Object
implements Mapper<A,B>

ReversedMapper is used to wrap an existing mapper and reverse it's direction

Author:
matt.deboer@gmail.com

Method Summary
 Type<A> getAType()
           
 Type<B> getBType()
           
 void mapAtoB(A a, B b, MappingContext context)
          Maps the properties of an instance of type A to the properties of an instance of type B.
 void mapBtoA(B b, A a, MappingContext context)
          Maps the properties of an instance of type B to the properties of an instance of type A.
static
<A,B> Mapper<A,B>
reverse(Mapper<B,A> mapperToReverse)
          Reterns a Mapper which is a reversal of the supplied Mapper
 void setMapperFacade(MapperFacade mapper)
          Store an instance of the current MapperFacade which may be used in mapping of nested types.
 void setUsedMappers(Mapper<Object,Object>[] mappers)
          Store the set of custom mappers used by this mapper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

reverse

public static <A,B> Mapper<A,B> reverse(Mapper<B,A> mapperToReverse)
Reterns a Mapper which is a reversal of the supplied Mapper

Parameters:
mapperToReverse -
Returns:

mapAtoB

public void mapAtoB(A a,
                    B b,
                    MappingContext context)
Description copied from interface: Mapper
Maps the properties of an instance of type A to the properties of an instance of type B.

Specified by:
mapAtoB in interface Mapper<A,B>
Parameters:
a - the object from which to read the properties
b - the object onto which the properties should be mapped

mapBtoA

public void mapBtoA(B b,
                    A a,
                    MappingContext context)
Description copied from interface: Mapper
Maps the properties of an instance of type B to the properties of an instance of type A.

Specified by:
mapBtoA in interface Mapper<A,B>
Parameters:
b - the object from which to read the properties
a - the object onto which the properties should be mapped

setMapperFacade

public void setMapperFacade(MapperFacade mapper)
Description copied from interface: Mapper
Store an instance of the current MapperFacade which may be used in mapping of nested types.

Specified by:
setMapperFacade in interface Mapper<A,B>

setUsedMappers

public void setUsedMappers(Mapper<Object,Object>[] mappers)
Description copied from interface: Mapper
Store the set of custom mappers used by this mapper.

Specified by:
setUsedMappers in interface Mapper<A,B>

getAType

public Type<A> getAType()
Specified by:
getAType in interface MappedTypePair<A,B>
Returns:
the 'A' type for this mapped pair

getBType

public Type<B> getBType()
Specified by:
getBType in interface MappedTypePair<A,B>
Returns:
the 'B' type for this mapped pair


Copyright © 2013 Glasnost. All Rights Reserved.