public class ConvertUtils extends Object
| 构造器和说明 |
|---|
ConvertUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static <T> T |
convert(Class<T> type,
Object value)
转换值为指定类型
|
static <T> T |
convert(Class<T> type,
Object value,
T defaultValue)
转换值为指定类型
|
static <T> T |
convert(Type type,
Object value)
转换值为指定类型
|
static <T> T |
convert(Type type,
Object value,
T defaultValue)
转换值为指定类型
|
static <T> T |
convert(cn.hutool.core.lang.TypeReference<T> reference,
Object value)
转换值为指定类型
|
static boolean |
isJson(Object value)
是否为JSON字符串
|
public static <T> T convert(Class<T> type, Object value) throws cn.hutool.core.convert.ConvertException
T - 目标类型type - 类型value - 值cn.hutool.core.convert.ConvertException - 转换器不存在public static boolean isJson(Object value)
value - 判断对象public static <T> T convert(cn.hutool.core.lang.TypeReference<T> reference,
Object value)
throws cn.hutool.core.convert.ConvertException
T - 目标类型reference - 类型参考,用于持有转换后的泛型类型value - 值cn.hutool.core.convert.ConvertException - 转换器不存在public static <T> T convert(Type type, Object value) throws cn.hutool.core.convert.ConvertException
T - 目标类型type - 类型value - 值cn.hutool.core.convert.ConvertException - 转换器不存在public static <T> T convert(Class<T> type, Object value, T defaultValue) throws cn.hutool.core.convert.ConvertException
T - 目标类型type - 类型value - 值defaultValue - 默认值cn.hutool.core.convert.ConvertException - 转换器不存在Copyright © 2022. All rights reserved.