-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0317077
commit 3ac985d
Showing
8 changed files
with
177 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
vertx-gaia/vertx-ams/src/main/qas/io/horizon/specification/typed/THex.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package io.horizon.specification.typed; | ||
|
||
import io.vertx.core.Future; | ||
import io.vertx.core.json.JsonArray; | ||
import io.vertx.core.json.JsonObject; | ||
|
||
/** | ||
* 「六维执行接口」 | ||
* 可以在不同模块中使用,参考六个核心维度: | ||
* <pre><code> | ||
* 1. 输入执行维度 | ||
* T -> 核心DTO | ||
* JsonObject -> 单记录执行 | ||
* JsonArray -> 多记录执行 | ||
* 2. 行为维度 | ||
* Sync -> 同步执行(默认方式) | ||
* Async -> 异步执行 | ||
* 最终转换成 2 x 3 的六维度处理 | ||
* </code></pre> | ||
* | ||
* @author lang : 2023-06-03 | ||
*/ | ||
public interface THex<I, O> extends THexJ<O> { | ||
|
||
/** | ||
* (核心DTO)专用检查方法,检查数据结果是否符合预期 | ||
* | ||
* @param data 数据 | ||
* @param config 配置 | ||
* | ||
* @return {@link O} | ||
*/ | ||
O execute(I data, JsonObject config); | ||
|
||
/** | ||
* 「异步版本」(核心DTO)专用检查方法,检查数据结果是否符合预期 | ||
* | ||
* @param data 数据 | ||
* @param config 配置 | ||
* | ||
* @return {@link Future} | ||
*/ | ||
default Future<O> executeAsync(final I data, final JsonObject config) { | ||
return Future.succeededFuture(this.execute(data, config)); | ||
} | ||
} | ||
|
||
interface THexJ<O> { | ||
/** | ||
* (JsonObject)专用检查方法,检查数据结果是否符合预期 | ||
* | ||
* @param data 数据 | ||
* @param config 配置 | ||
* | ||
* @return {@link O} | ||
*/ | ||
O executeJ(final JsonObject data, final JsonObject config); | ||
|
||
/** | ||
* 「异步版本」(JsonObject)专用检查方法,检查数据结果是否符合预期 | ||
* | ||
* @param data 数据 | ||
* @param config 配置 | ||
* | ||
* @return {@link Future} | ||
*/ | ||
default Future<O> executeJAsync(final JsonObject data, final JsonObject config) { | ||
return Future.succeededFuture(this.executeJ(data, config)); | ||
} | ||
|
||
/** | ||
* (JsonArray)专用检查方法,检查数据结果是否符合预期 | ||
* | ||
* @param data 数据 | ||
* @param config 配置 | ||
* | ||
* @return {@link O} | ||
*/ | ||
O executeJ(final JsonArray data, final JsonObject config); | ||
|
||
/** | ||
* 「异步版本」(JsonArray)专用检查方法,检查数据结果是否符合预期 | ||
* | ||
* @param data 数据 | ||
* @param config 配置 | ||
* | ||
* @return {@link O} | ||
*/ | ||
default Future<O> executeJAsync(final JsonArray data, final JsonObject config) { | ||
return Future.succeededFuture(this.executeJ(data, config)); | ||
} | ||
} |
94 changes: 0 additions & 94 deletions
94
vertx-gaia/vertx-ams/src/main/qas/io/horizon/specification/uca/HChecker.java
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
vertx-gaia/vertx-ams/src/main/qas/io/horizon/specification/uca/HTrue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.horizon.specification.uca; | ||
|
||
import io.horizon.specification.typed.THex; | ||
import io.vertx.core.json.JsonArray; | ||
import io.vertx.core.json.JsonObject; | ||
|
||
/** | ||
* 「检查器」 | ||
* 可以在不同的模块中使用,主要用于检查数据本身的合法性,核心使用场景: | ||
* <pre><code> | ||
* 1. 请求拦截器:可配置到 AOP 层直接拦截请求,检查请求的合法性 | ||
* 2. 检查结果通常会以异步的方式处理 | ||
* - 成功:{@link io.vertx.core.Future#succeededFuture(Object)} | ||
* - 失败:{@link io.vertx.core.Future#failedFuture(Throwable)} | ||
* 3. 不仅如此,检查的最终结果会直接返回输入信息,方便后续的处理 | ||
* </code></pre> | ||
* | ||
* @author lang : 2023-05-27 | ||
*/ | ||
public interface HTrue<T> extends THex<T, Boolean> { | ||
|
||
@Override | ||
default Boolean execute(final T data, final JsonObject config) { | ||
return Boolean.TRUE; | ||
} | ||
|
||
@Override | ||
default Boolean executeJ(final JsonObject data, final JsonObject config) { | ||
return Boolean.TRUE; | ||
} | ||
|
||
@Override | ||
default Boolean executeJ(final JsonArray data, final JsonObject config) { | ||
return Boolean.TRUE; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.