This commit is contained in:
Looly
2024-08-22 22:29:34 +08:00
parent 1176b144d7
commit c6777244a0
13 changed files with 257 additions and 35 deletions

View File

@@ -20,7 +20,6 @@ import org.dromara.hutool.core.bean.path.BeanPath;
import org.dromara.hutool.core.convert.ConvertException;
import org.dromara.hutool.core.convert.Converter;
import org.dromara.hutool.core.lang.mutable.MutableEntry;
import org.dromara.hutool.json.convert.JSONConverter;
import java.io.Serializable;
import java.io.StringWriter;
@@ -193,6 +192,6 @@ public interface JSON extends Converter, Cloneable, Serializable {
@Override
default Object convert(final Type targetType, final Object value) throws ConvertException {
return JSONConverter.of(config()).convert(targetType, value);
return config().getConverter().convert(targetType, value);
}
}

View File

@@ -61,8 +61,9 @@ public class JSONConverter implements Converter, Serializable {
public static final JSONConverter INSTANCE = new JSONConverter(null);
static {
RegisterConverter.getInstance().putCustom(JSONObject.class, INSTANCE);
RegisterConverter.getInstance().putCustom(JSONArray.class, INSTANCE);
final RegisterConverter converter = RegisterConverter.getInstance();
converter.putCustom(JSONObject.class, INSTANCE);
converter.putCustom(JSONArray.class, INSTANCE);
}
/**