mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
add AbstractClientEngine
This commit is contained in:
parent
011abcba4b
commit
c657a4f9f4
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2024. looly(loolly@aliyun.com)
|
||||
* Hutool is licensed under Mulan PSL v2.
|
||||
* You can use this software according to the terms and conditions of the Mulan PSL v2.
|
||||
* You may obtain a copy of Mulan PSL v2 at:
|
||||
* https://license.coscl.org.cn/MulanPSL2
|
||||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
|
||||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
|
||||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
|
||||
* See the Mulan PSL v2 for more details.
|
||||
*/
|
||||
|
||||
package org.dromara.hutool.http.client.engine;
|
||||
|
||||
import org.dromara.hutool.http.client.ClientConfig;
|
||||
|
||||
/**
|
||||
* 客户端引擎抽象类,用于保存配置和定义初始化,并提供:
|
||||
* <ul>
|
||||
* <li>{@link #reset()}用于重置客户端</li>
|
||||
* <li>{@link #initEngine()}初始化客户端</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Looly
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public abstract class AbstractClientEngine implements ClientEngine{
|
||||
|
||||
protected ClientConfig config;
|
||||
|
||||
@Override
|
||||
public ClientEngine init(final ClientConfig config) {
|
||||
this.config = config;
|
||||
reset();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置引擎
|
||||
*/
|
||||
protected abstract void reset();
|
||||
|
||||
/**
|
||||
* 初始化引擎,实现逻辑中如果初始化完成,不再重新初始化
|
||||
*/
|
||||
protected abstract void initEngine();
|
||||
}
|
@ -13,7 +13,14 @@
|
||||
package org.dromara.hutool.json.engine;
|
||||
|
||||
/**
|
||||
* JSONEngine抽象实现,
|
||||
* JSONEngine抽象类,用于保存配置和定义初始化,并提供:
|
||||
* <ul>
|
||||
* <li>{@link #reset()}用于重置引擎</li>
|
||||
* <li>{@link #initEngine()}初始化引擎</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Looly
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public abstract class AbstractJSONEngine implements JSONEngine {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user