Interface Converter
public interface Converter
Type converter to convert an object to a target type.
- Version:
- $Revision: 7564 $
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canConvert
(Object sourceObject, ReifiedType targetType) Return if this converter is able to convert the specified object to the specified type.convert
(Object sourceObject, ReifiedType targetType) Convert the specified object to an instance of the specified type.
-
Method Details
-
canConvert
Return if this converter is able to convert the specified object to the specified type.- Parameters:
sourceObject
- The source objects
to convert.targetType
- The target typeT
.- Returns:
true
if the conversion is possible,false
otherwise.
-
convert
Convert the specified object to an instance of the specified type.- Parameters:
sourceObject
- The source objects
to convert.targetType
- The target typeT
.- Returns:
- An instance with a type that is assignable from targetType's raw class
- Throws:
Exception
- If the conversion cannot succeed. This exception should not be thrown when thecanConvert
method has returnedtrue
.
-