net.sf.molae.pipe.trafo
Class AbstractTransformer<S,T>

java.lang.Object
  extended by net.sf.molae.pipe.trafo.AbstractTransformer<S,T>
All Implemented Interfaces:
TwoWayTransformer<S,T>

public abstract class AbstractTransformer<S,T>
extends Object
implements TwoWayTransformer<S,T>

Convenience class for implementing transformers. This class provides a skeletal implementation of the TwoWayTransformer interface, to minimize the effort required to implement this interface. If the retransformation is not used, only transform(Object) has to be implemented.

Since:
2.0

Constructor Summary
AbstractTransformer()
           
 
Method Summary
 boolean isRetrievable(T input)
          Indicates if the origin of the specified object can be calculated.
 S retransform(T input)
          Calculates the transformation origin of the specified object.
abstract  T transform(S input)
          Transforms the input object (leaving it unchanged) into some output object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractTransformer

public AbstractTransformer()
Method Detail

transform

public abstract T transform(S input)
Transforms the input object (leaving it unchanged) into some output object.

Specified by:
transform in interface TwoWayTransformer<S,T>
Parameters:
input - the object to be transformed, should be left unchanged
Returns:
a transformed object
Throws:
ClassCastException - if the input is the wrong class
IllegalArgumentException - if the input is invalid

retransform

public S retransform(T input)
Calculates the transformation origin of the specified object. Not implemented.

Specified by:
retransform in interface TwoWayTransformer<S,T>
Parameters:
input - the object for which the transformation origin is searched.
Returns:
the transformation origin of the specified object.
Throws:
UnsupportedOperationException - always

isRetrievable

public boolean isRetrievable(T input)
Indicates if the origin of the specified object can be calculated. This implementation always returns false.

Specified by:
isRetrievable in interface TwoWayTransformer<S,T>
Parameters:
input - the object for which the transformation origin is searched.
Returns:
always false