类 ConversionUtils
java.lang.Object
spring.turbo.core.ConversionUtils
ConversionService相关工具- 从以下版本开始:
- 1.0.0
- 作者:
- 应卓
- 另请参阅:
-
SpringUtilsConversionService
-
方法概要
修饰符和类型方法说明static booleancanConverter(Class<?> sourceType, Class<?> targetType) 判断是否可以完成转换static <T> T转换static <T> TconvertOrThrow(Object source, Class<T> targetType) 转换
-
方法详细资料
-
canConverter
判断是否可以完成转换- 参数:
sourceType- 源类型targetType- 目标类型- 返回:
- 判断结果
- 抛出:
UnsupportedOperationException- 无法定位ApplicationContext实例
-
convert
转换- 类型参数:
T- 目标类型泛型- 参数:
source- 源对象实例targetType- 目标类型- 返回:
- 转换结果或null
- 抛出:
UnsupportedOperationException- 无法定位ApplicationContext实例
-
convertOrThrow
转换- 类型参数:
T- 目标类型泛型- 参数:
source- 源对象实例targetType- 目标类型- 返回:
- 转换结果或null
- 抛出:
UnsupportedOperationException- 无法定位ApplicationContext实例IllegalArgumentException- 无法转换
-