public class CompositeConverter extends RegisterConverter
处理null、Opt、Optional --> 自定义匹配转换器 --> 自定义类型转换器 --> 预注册的标准转换器 --> Map、集合、Enum等特殊转换器 --> Bean转换器
| Constructor and Description |
|---|
CompositeConverter()
构造
|
| Modifier and Type | Method and Description |
|---|---|
Object |
convert(Type type,
Object value)
转换值为指定类型
|
<T> T |
convert(Type type,
Object value,
T defaultValue)
转换值为指定类型
自定义转换器优先 |
<T> T |
convert(Type type,
Object value,
T defaultValue,
boolean isCustomFirst)
转换值为指定类型
|
static CompositeConverter |
getInstance()
获得单例的 ConverterRegistry
|
getConverter, getCustomConverter, getCustomConverter, getDefaultConverter, register, registerpublic static CompositeConverter getInstance()
public Object convert(Type type, Object value) throws ConvertException
convert in interface Converterconvert in class RegisterConvertertype - 类型value - 值nullConvertException - 转换器不存在public <T> T convert(Type type, Object value, T defaultValue) throws ConvertException
T - 转换的目标类型(转换器转换到的类型)type - 类型value - 值defaultValue - 默认值ConvertException - 转换器不存在public <T> T convert(Type type, Object value, T defaultValue, boolean isCustomFirst) throws ConvertException
T - 转换的目标类型(转换器转换到的类型)type - 类型目标value - 被转换值defaultValue - 默认值isCustomFirst - 是否自定义转换器优先ConvertException - 转换器不存在Copyright © 2024. All rights reserved.