mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package cn.hutool.json;
|
||||
|
||||
import cn.hutool.core.bean.BeanPath;
|
||||
import cn.hutool.core.reflect.TypeReference;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.io.StringWriter;
|
||||
@@ -171,16 +170,4 @@ public interface JSON extends Cloneable, Serializable {
|
||||
default <T> T toBean(final Type type) {
|
||||
return JSONConverter.jsonConvert(type, this, getConfig());
|
||||
}
|
||||
|
||||
/**
|
||||
* 转为实体类对象,转换异常将被抛出
|
||||
*
|
||||
* @param <T> Bean类型
|
||||
* @param reference {@link TypeReference}类型参考子类,可以获取其泛型参数中的Type类型
|
||||
* @return 实体类对象
|
||||
* @since 4.2.2
|
||||
*/
|
||||
default <T> T toBean(final TypeReference<T> reference) {
|
||||
return toBean(reference.getType());
|
||||
}
|
||||
}
|
||||
|
@@ -333,6 +333,10 @@ public class JSONUtil {
|
||||
if (obj instanceof CharSequence) {
|
||||
return StrUtil.str((CharSequence) obj);
|
||||
}
|
||||
|
||||
if(obj instanceof Number){
|
||||
return obj.toString();
|
||||
}
|
||||
return toJsonStr(parse(obj, jsonConfig));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user