Interface Converter
-
- All Known Implementing Classes:
ChainingConverter
public interface ConverterInterface describing a mechanism that can convert data from one to another type.- Author:
- Rene de Waele
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleancanConvert(Class<?> sourceType, Class<?> targetType)Indicates whether this converter is capable of converting the givensourceTypeto thetargetType.default <T> SerializedObject<T>convert(SerializedObject<?> original, Class<T> targetType)Converts the data format of the givenoriginalIntermediateRepresentation to the target data type.<T> Tconvert(Object original, Class<?> sourceType, Class<T> targetType)Converts the given object into another using the source type to find the conversion path.default <T> Tconvert(Object original, Class<T> targetType)Converts the given object into another.
-
-
-
Method Detail
-
canConvert
boolean canConvert(Class<?> sourceType, Class<?> targetType)
Indicates whether this converter is capable of converting the givensourceTypeto thetargetType.- Parameters:
sourceType- The type of data to convert fromtargetType- The type of data to convert to- Returns:
trueif conversion is possible,falseotherwise
-
convert
default <T> T convert(Object original, Class<T> targetType)
Converts the given object into another.- Type Parameters:
T- the target data type- Parameters:
original- the value to converttargetType- The type of data to convert to- Returns:
- the converted value
-
convert
<T> T convert(Object original, Class<?> sourceType, Class<T> targetType)
Converts the given object into another using the source type to find the conversion path.- Type Parameters:
T- the target data type- Parameters:
original- the value to convertsourceType- the type of data to converttargetType- The type of data to convert to- Returns:
- the converted value
-
convert
default <T> SerializedObject<T> convert(SerializedObject<?> original, Class<T> targetType)
Converts the data format of the givenoriginalIntermediateRepresentation to the target data type.- Type Parameters:
T- the target data type- Parameters:
original- The source to converttargetType- The type of data to convert to- Returns:
- the converted representation
-
-