mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
eac5024887
commit
b7035dd4b4
@ -22,7 +22,13 @@ import org.dromara.hutool.core.util.CharsetUtil;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* JSON引擎实现
|
||||
* JSON引擎接口,提供API:
|
||||
* <ul>
|
||||
* <li>serialize: JSON序列化, 将Bean对象序列化为JSON字符串</li>
|
||||
* <li>deserialize:JSON反序列化,将JSON字符串解析为Bean对象</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>{@link #init(JSONEngineConfig)}用于使用公共配置,初始化引擎。</p>
|
||||
*
|
||||
* @author Looly
|
||||
* @since 6.0.0
|
||||
@ -42,8 +48,8 @@ public interface JSONEngine {
|
||||
/**
|
||||
* 生成JSON数据(序列化),用于将指定的Bean对象通过Writer写出为JSON字符串
|
||||
*
|
||||
* @param bean Java Bean(POJO)对象
|
||||
* @param out 写出到的{@link OutputStream}
|
||||
* @param bean Java Bean(POJO)对象
|
||||
* @param out 写出到的{@link OutputStream}
|
||||
*/
|
||||
void serialize(Object bean, OutputStream out);
|
||||
|
||||
|
@ -23,7 +23,12 @@ import org.dromara.hutool.core.text.StrUtil;
|
||||
import org.dromara.hutool.json.JSONException;
|
||||
|
||||
/**
|
||||
* JSON引擎工厂
|
||||
* JSON引擎工厂<br>
|
||||
* 通过SPI方式,动态查找用户引入的JSON实现库,并加载,提供两种加载方式:
|
||||
* <ul>
|
||||
* <li>{@link #getEngine()} 自动按照service文件中的顺序检查并加载第一个可用引擎。</li>
|
||||
* <li>{@link #createEngine(String)} 加载指定名称的引擎</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author looly
|
||||
* @since 6.0.0
|
||||
@ -48,10 +53,10 @@ public class JSONEngineFactory {
|
||||
*/
|
||||
public static JSONEngine createEngine(String engineName) throws JSONException {
|
||||
// fastjson名字兼容
|
||||
if(StrUtil.equalsIgnoreCase("fastjson", engineName)){
|
||||
if (StrUtil.equalsIgnoreCase("fastjson", engineName)) {
|
||||
engineName = "FastJSON2";
|
||||
}
|
||||
if(StrUtil.equalsIgnoreCase("hutool", engineName)){
|
||||
if (StrUtil.equalsIgnoreCase("hutool", engineName)) {
|
||||
engineName = "HutoolJSON";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user