!1051 [bug修复] 修复因使用反射读取JSON自定义类型导致性能下降为原来1/3的问题 by SHA-1: 5b2d2050d2

Merge pull request !1051 from 周鹏/v5-master
This commit is contained in:
Looly
2023-08-08 11:57:45 +00:00
committed by Gitee
3 changed files with 28 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
package cn.hutool.json;
import cn.hutool.core.bean.BeanPath;
import cn.hutool.core.bean.copier.IJSONTypeConverter;
import cn.hutool.core.lang.TypeReference;
import java.io.Serializable;
@@ -13,7 +14,7 @@ import java.lang.reflect.Type;
*
* @author Looly
*/
public interface JSON extends Cloneable, Serializable {
public interface JSON extends Cloneable, Serializable, IJSONTypeConverter {
/**
* 获取JSON配置
@@ -177,7 +178,7 @@ public interface JSON extends Cloneable, Serializable {
* @since 3.0.8
*/
default <T> T toBean(Type type) {
return JSONConverter.jsonConvert(type, this, getConfig());
return toBean(type, getConfig().isIgnoreError());
}
/**