net.sf.japaki.basic
Interface TwoWayTransformer<S,T>

All Known Implementing Classes:
FixedTargetTransformer, MultiLineTransformer, NumberTransformer, ValuePropertyTransformer

public interface TwoWayTransformer<S,T>

Specifies both the methods to transform and to retransform an object.
This is a copy of the class with the same name of the moleapipe project.


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 (optional operation).
 T transform(S input)
          Transforms the input object (leaving it unchanged) into some output object.
 

Method Detail

transform

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

Parameters:
input - the object to be transformed, should be left unchanged
Returns:
a transformed object
Throws:
ClassCastException - (runtime) if the input is the wrong class
IllegalArgumentException - (runtime) if the input is invalid

retransform

S retransform(T input)
Calculates the transformation origin of the specified object (optional operation). This is the inverse mapping of transform. If implemented, it must at least be ensured that
 transform(retransform(input)).equals(input)
 
for all objects, for that the retransformation is defined (that is retransform(input) does not throw an exception).
This implies that the retransformation is defined on a subset of the image of the transformation.

Parameters:
input - the object for which the transformation origin is searched.
Returns:
the transformation origin of the specified object.
Throws:
UnsupportedOperationException - if not implemented.
ClassCastException - if the retransformation is not defined for the class of the input element
IllegalArgumentException - if the retransformation for the input object is not defined

isRetrievable

boolean isRetrievable(T input)
Indicates if the origin of the specified object can be calculated. This requires that:
  1. retransform is implemented for this object and does not throw an exception.
  2. The object x returned by retransform is unique, or more formally: transform(o1).equals(transform(o2)) ⇒ o1.equals(o2)
This implies that
 retransform(transform(input)).equals(input)
 
for all objects where the retransformation is defined.

Parameters:
input - the object for which the transformation origin is searched.
Returns:
true if the origin of the specified object can be calculated.
Throws:
ClassCastException - if the input value can not be cast to T.