org.omnaest.utils.structure.element.converter
Class ElementConverterToBidirectionalConverterAdapter<FROM,TO>

java.lang.Object
  extended by org.omnaest.utils.structure.element.converter.ElementConverterToBidirectionalConverterAdapter<FROM,TO>
Type Parameters:
FROM -
TO -
All Implemented Interfaces:
Serializable, ElementBidirectionalConverter<FROM,TO>, ElementBidirectionalConverterSerializable<FROM,TO>, ElementConverter<FROM,TO>

public class ElementConverterToBidirectionalConverterAdapter<FROM,TO>
extends Object
implements ElementBidirectionalConverterSerializable<FROM,TO>

Adapter for two ElementConverter instances acting like an ElementBidirectionalConverter

If any given ElementConverter is null, the respective transformation direction will throw an UnsupportedOperationException

Author:
Omnaest
See Also:
Serialized Form

Constructor Summary
ElementConverterToBidirectionalConverterAdapter(ElementConverter<FROM,TO> elementConverter, ElementConverter<TO,FROM> elementConverterReverse)
           
 
Method Summary
 TO convert(FROM element)
          Transforms a single element from one type into another.
 FROM convertBackwards(TO element)
          Converts an element in backwards way
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementConverterToBidirectionalConverterAdapter

public ElementConverterToBidirectionalConverterAdapter(ElementConverter<FROM,TO> elementConverter,
                                                       ElementConverter<TO,FROM> elementConverterReverse)
Parameters:
elementConverter -
elementConverterReverse -
See Also:
ElementConverterToBidirectionalConverterAdapter
Method Detail

convertBackwards

public FROM convertBackwards(TO element)
Description copied from interface: ElementBidirectionalConverter
Converts an element in backwards way

Specified by:
convertBackwards in interface ElementBidirectionalConverter<FROM,TO>
Returns:

convert

public TO convert(FROM element)
Description copied from interface: ElementConverter
Transforms a single element from one type into another.

Specified by:
convert in interface ElementConverter<FROM,TO>
Returns:
converted element


Copyright © 2013. All Rights Reserved.