Interface Converter
-
@ConsumerType public interface ConverterType converter to convert an object to a target type.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanConvert(java.lang.Object sourceObject, ReifiedType targetType)Return if this converter is able to convert the specified object to the specified type.java.lang.Objectconvert(java.lang.Object sourceObject, ReifiedType targetType)Convert the specified object to an instance of the specified type.
-
-
-
Method Detail
-
canConvert
boolean canConvert(java.lang.Object sourceObject, ReifiedType targetType)Return if this converter is able to convert the specified object to the specified type.- Parameters:
sourceObject- The source objectsto convert.targetType- The target typeT.- Returns:
trueif the conversion is possible,falseotherwise.
-
convert
java.lang.Object convert(java.lang.Object sourceObject, ReifiedType targetType) throws java.lang.ExceptionConvert the specified object to an instance of the specified type.- Parameters:
sourceObject- The source objectsto convert.targetType- The target typeT.- Returns:
- An instance with a type that is assignable from targetType's raw class
- Throws:
java.lang.Exception- If the conversion cannot succeed. This exception should not be thrown when thecanConvertmethod has returnedtrue.
-
-