mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -3,6 +3,7 @@ package cn.hutool.json;
|
||||
import cn.hutool.core.bean.BeanPath;
|
||||
import cn.hutool.core.collection.ArrayIter;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.CharUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -41,7 +42,7 @@ public class JSONArray implements JSON, JSONGetter<Integer>, List<Object>, Rando
|
||||
/** 持有原始数据的List */
|
||||
private final List<Object> rawList;
|
||||
/** 配置项 */
|
||||
private JSONConfig config;
|
||||
private final JSONConfig config;
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------- Constructor start
|
||||
/**
|
||||
@@ -365,14 +366,13 @@ public class JSONArray implements JSON, JSONGetter<Integer>, List<Object>, Rando
|
||||
return rawList.contains(o);
|
||||
}
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
return rawList.toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({"unchecked", "NullableProblems"})
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public <T> T[] toArray(T[] a) {
|
||||
return (T[]) JSONConverter.toArray(this, a.getClass().getComponentType());
|
||||
}
|
||||
@@ -600,7 +600,7 @@ public class JSONArray implements JSON, JSONGetter<Integer>, List<Object>, Rando
|
||||
init((JSONTokener) source);
|
||||
} else {
|
||||
Iterator<?> iter;
|
||||
if (source.getClass().isArray()) {// 数组
|
||||
if (ArrayUtil.isArray(source)) {// 数组
|
||||
iter = new ArrayIter<>(source);
|
||||
} else if (source instanceof Iterator<?>) {// Iterator
|
||||
iter = ((Iterator<?>) source);
|
||||
|
@@ -46,7 +46,7 @@ public class JSONObject implements JSON, JSONGetter<String>, Map<String, Object>
|
||||
/** JSON的KV持有Map */
|
||||
private final Map<String, Object> rawHashMap;
|
||||
/** 配置项 */
|
||||
private JSONConfig config;
|
||||
private final JSONConfig config;
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------------------- Constructor start
|
||||
/**
|
||||
@@ -677,9 +677,7 @@ public class JSONObject implements JSON, JSONGetter<String>, Map<String, Object>
|
||||
} else if (source instanceof JSONTokener) {
|
||||
// JSONTokener
|
||||
init((JSONTokener) source);
|
||||
} else if (source instanceof Number) {
|
||||
// ignore Number
|
||||
} else {
|
||||
} else if(BeanUtil.isReadableBean(source.getClass())){
|
||||
// 普通Bean
|
||||
this.populateMap(source);
|
||||
}
|
||||
|
Reference in New Issue
Block a user