| Package | Description |
|---|---|
| cn.hutool.core.convert |
万能类型转换器以及各种类型转换的实现类,其中Convert为转换器入口,提供各种toXXX方法和convert方法
|
| cn.hutool.core.map |
Map相关封装,提供特殊Map实现以及Map工具MapUtil
|
| cn.hutool.extra.spring |
Spring相关工具封装
|
| cn.hutool.json |
JSON封装,基于json.org官方库改造
|
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
Convert.convert(TypeReference<T> reference,
Object value)
转换值为指定类型
|
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
MapUtil.get(Map<?,?> map,
Object key,
TypeReference<T> type)
获取Map指定key的值,并转换为指定类型
|
static <T> T |
MapUtil.get(Map<?,?> map,
Object key,
TypeReference<T> type,
T defaultValue)
获取Map指定key的值,并转换为指定类型
|
static <T> T |
MapUtil.getQuietly(Map<?,?> map,
Object key,
TypeReference<T> type,
T defaultValue)
获取Map指定key的值,并转换为指定类型,转换失败后返回null,不抛异常
|
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
SpringUtil.getBean(TypeReference<T> reference)
通过类型参考返回带泛型参数的Bean
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
JSON.getByPath(String expression,
TypeReference<T> targetType)
通过表达式获取JSON中嵌套的对象
.表达式,可以获取Bean对象中的属性(字段)值或者Map中key对应的值 []表达式,可以获取集合等对象中对应index的值 表达式栗子: persion persion.name persons[3] person.friends[5].name 获取表达式对应值后转换为对应类型的值 |
<T> T |
JSONArray.getByPath(String expression,
TypeReference<T> targetType) |
<T> T |
JSONObject.getByPath(String expression,
TypeReference<T> targetType) |
static <T> T |
JSONUtil.toBean(JSON json,
TypeReference<T> typeReference,
boolean ignoreError)
转为实体类对象
|
static <T> T |
JSONUtil.toBean(String jsonString,
TypeReference<T> typeReference,
boolean ignoreError)
JSON字符串转为实体类对象,转换异常将被抛出
|
default <T> T |
JSON.toBean(TypeReference<T> reference)
转为实体类对象,转换异常将被抛出
|
Copyright © 2026. All rights reserved.