public class SpecialConverter extends Object implements Converter, Serializable
null继续其它转换规则| Modifier and Type | Method and Description |
|---|---|
Object |
convert(Type targetType,
Class<?> rawType,
Object value)
转换值
|
Object |
convert(Type targetType,
Object value)
转换为指定类型
如果类型无法确定,将读取默认值的类型做为目标类型 |
Converter |
getConverter(Type type,
Class<?> rawType,
Object value)
获得匹配的转换器
|
static SpecialConverter |
getInstance()
获得单例的 CustomConverter
|
public static SpecialConverter getInstance()
public Object convert(Type targetType, Object value) throws ConvertException
Converterconvert in interface ConvertertargetType - 目标Type,非泛型类使用value - 原始值,如果对象实现了此接口,则value为thisConvertException - 转换无法正常完成或转换异常时抛出此异常public Object convert(Type targetType, Class<?> rawType, Object value) throws ConvertException
targetType - 目标类型rawType - 目标原始类型(即目标的Class)value - 被转换的值nullConvertException - 转换异常,即找到了对应的转换器,但是转换失败Copyright © 2024. All rights reserved.