|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.molae.pipe.trafo.MapAsTransformer<S,T>
public final class MapAsTransformer<S,T>
Implements a transformer
on the basis of a Map
.
The transformation is defined for each element of the key set of the map.
The result of the transformation is the associated value of the key in
the map.
The retransformation is defined for each element of the value set of the
map.
The result of the retransformation is the associated key of the value in
the map.
Constructor Summary | |
---|---|
MapAsTransformer(Map<S,T> base)
Constructs a MapAsTransformer object. |
Method Summary | |
---|---|
boolean |
isRetrievable(T input)
Indicates if this transformer is injective. |
S |
retransform(T input)
Returns a key of the base map that has the specified value. |
String |
toString()
Returns a string representation of the object. |
T |
transform(S input)
Returns the value of the specified key in the base map. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MapAsTransformer(Map<S,T> base)
base
- the underlying map
NullPointerException
- if any of the specified objects is
null
.Method Detail |
---|
public String toString()
toString
in class Object
public T transform(S input)
null
is returned.
transform
in interface TwoWayTransformer<S,T>
input
- the object to transform
public S retransform(T input)
retransform
in interface TwoWayTransformer<S,T>
input
- the object for which the transformation origin is searched.
public boolean isRetrievable(T input)
false
because the underlying map can
change and it cannot be guaranteed that the object is
retrievable.
isRetrievable
in interface TwoWayTransformer<S,T>
input
- the object for which the transformation origin is searched.
true
if the origin of the specified object can
be calculated.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |