java.lang.Object
org.klojang.convert.Morph<T>
- Type Parameters:
T- The type to which incoming values will be converted
Performs a wide variety of type conversions.
- Author:
- Ayco Holleman
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Morph
Creates a newMorphinstance that will convert values to the specified type.- Parameters:
targetType- The type to which to convert values
-
-
Method Details
-
convert
Converts the specified object to the specified type.- Type Parameters:
U- The target type- Parameters:
obj- The value to converttargetType- TheClassobject corresponding to the target type- Returns:
- The converted value
- Throws:
TypeConversionException- If the conversion did not succeed
-
convert
Converts the specified object into an instance of the type specified through the constructor.- Parameters:
obj- The value to convert- Returns:
- An instance of the target type
- Throws:
TypeConversionException- If the conversion did not succeed
-