|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.math3.util.TransformerMap
public class TransformerMap
This TansformerMap automates the transformation of mixed object types.
It provides a means to set NumberTransformers that will be selected
based on the Class of the object handed to the Maps
double transform(Object o)
method.
Constructor Summary | |
---|---|
TransformerMap()
Build a map containing only the default transformer. |
Method Summary | |
---|---|
Set<Class<?>> |
classes()
Returns the Set of Classes used as keys in the map. |
void |
clear()
Clears all the Class to Transformer mappings. |
boolean |
containsClass(Class<?> key)
Tests if a Class is present in the TransformerMap. |
boolean |
containsTransformer(NumberTransformer value)
Tests if a NumberTransformer is present in the TransformerMap. |
boolean |
equals(Object other)
|
NumberTransformer |
getTransformer(Class<?> key)
Returns the Transformer that is mapped to a class if mapping is not present, this returns null. |
int |
hashCode()
|
NumberTransformer |
putTransformer(Class<?> key,
NumberTransformer transformer)
Sets a Class to Transformer Mapping in the Map. |
NumberTransformer |
removeTransformer(Class<?> key)
Removes a Class to Transformer Mapping in the Map. |
double |
transform(Object o)
Attempts to transform the Object against the map of NumberTransformers. |
Collection<NumberTransformer> |
transformers()
Returns the Set of NumberTransformers used as values in the map. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TransformerMap()
Method Detail |
---|
public boolean containsClass(Class<?> key)
key
- Class to check
public boolean containsTransformer(NumberTransformer value)
value
- NumberTransformer to check
public NumberTransformer getTransformer(Class<?> key)
key
- The Class of the object
public NumberTransformer putTransformer(Class<?> key, NumberTransformer transformer)
key
- The Classtransformer
- The NumberTransformer
public NumberTransformer removeTransformer(Class<?> key)
key
- The Class
public void clear()
public Set<Class<?>> classes()
public Collection<NumberTransformer> transformers()
public double transform(Object o) throws MathIllegalArgumentException
transform
in interface NumberTransformer
o
- the Object to be transformed.
MathIllegalArgumentException
- if the Object can not be
transformed into a Double.NumberTransformer.transform(java.lang.Object)
public boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |